I have a covariance matrix,
S, which I use Cholesky decomposition to find
A. It is stated that
AA'=S, however, I am not recovering
S when I do
AA'. The example code in R is as follows.
S <- matrix(c(1.091385, 1.949606, 1.949606, 4.520746), 2, 2) A <- chol(S) T <- t(A) R <- A %*% T
As can be seen,
S is as follows.
1.091385, 1.949606 1.949606, 4.520746
R is as follows.
4.574082, 1.901370 1.901370, 1.038049
And for completeness,
A is as follows.
1.044694, 1.866199 0.000000, 1.018847
However, when I do
A'A with the code
R <- T %*% A, I do recover
Any ideas on what I'm doing wrong? Or is the link on Wikipedia wrong? The R examples on Cholesky decomposition seems to suggest
S(the expected answer). So, insofar as the link on Wikipedia, should I use
A'as returned by
crossprodis doing. $\endgroup$
Uin the call of the routine
dpstrfthat actually compute the Cholesky.) $\endgroup$