[R] Generate a matrix Q satisfying t(Q)%*%Q=Z and XQ=W

Stephane DRAY stephane.dray at umontreal.ca
Wed Jul 7 00:28:46 CEST 2004


Hello,
I have a question that is not directly related to R ... but I try to do it 
in R ;-) :

I would like to generate a matrix Q satisfying (for a given Z, X and W) the 
two following conditions:

t(Q)%*%Q=Z  (1)
XQ=W (2)

where:
Q is m rows and r columns
X is p rows and m columns
D is p rows and r columns
C is r rows and r columns
with m>p,r


e.g:
m=6,
p=2
r=3

Z=matrix(c(1,.2,.5,.2,1,.45,.5,.45,1),3,3)
X=matrix(c(.1,.3,.5,.6,.2,.1,.8,1,.4,.2,.2,.9),2,6)
W=matrix(c(0,.8,.4,.6,.2,0),2,3)

#Create a matrix satisfying (1) is easy:

A=matrix(runif(18),6,3)
Q1=svd(A)$u%*%chol(Z)


#For the second condition (2), a solution is given by

Q2=A%*%ginv(X%*%A)%*%W





I do not know how to create a matrix Q that satisfies the two 
conditions.  I have try to construct an iterative procedure without success 
(no convergence):

eps=10
i=0
while(eps>.5)
{
Q1=svd(Q2)$u%*%chol(Z)
Q2=Q1%*%ginv(X%*%Q1)%*%W
eps=sum(abs(Q1-Q2))
cat(i,":",eps,"\n")
i=i+1
}

Perhaps someone could have any idea to solve the problem, or a reference on 
this kind of question or the email of another list where I should ask this 
question.

Thanks in advance,

Sincerely.

Stéphane DRAY
-------------------------------------------------------------------------------------------------- 

Département des Sciences Biologiques
Université de Montréal, C.P. 6128, succursale centre-ville
Montréal, Québec H3C 3J7, Canada

Tel : 514 343 6111 poste 1233
E-mail : stephane.dray at umontreal.ca
-------------------------------------------------------------------------------------------------- 

Web                                          http://www.steph280.freesurf.fr/




More information about the R-help mailing list