-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of Shawn Koppenhoefer
Sent: Tuesday, April 12, 2011 11:37 AM
To: r-help at r-project.org
Subject: Re: [R] B %*% t(B) = R , then solve for B
Importance: High
BTW,
The same solution can be found using SVD (Singular Value Decomposition)
example,
## Define the matrix that we want to decompose into the product of a
matrix and its transform
M<-matrix(c(0.6098601, 0.2557882, 0.1857773,
0.2557882, 0.5127065, -0.1384238,
0.1857773, -0.1384238, 0.9351089 ),
nrow=3, ncol=3, byrow=TRUE)
## Compute the singular-value decomposition, and construct F from its pieces
SVD=svd(M, nu=3, nv=3)
U=SVD$u
D=diag(SVD$d)
V=SVD$v
U %*% D %*% t(V)
F = U %*% sqrt(diag(SVD$d))
## Test to see of the product of F with its transpose is equal to M
F %*% t(F) #
[,1] [,2] [,3]
[1,] 0.6098601 0.2557882 0.1857773
[2,] 0.2557882 0.5127065 -0.1384238
[3,] 0.1857773 -0.1384238 0.9351089
/Shawn
p.s.
HOWEVER I would still like to find a solution that gives me a diagonal
matrix for F.
For example, I would like this result:,
[,1] [,2] [,3]
[1,] 0.781 0.000 0.000
[2,] 0.328 0.637 0.000
[3,] 0.238 -0.341 0.873
[[alternative HTML version deleted]]