UpperTriFactor.Rd
This function is an analog to the Cholesky decomposition.
UpperTriFactor(Sigma)
Sigma | A symmetric positive definite k x k matrix that can be
passed as argument to |
---|
an upper triangular matrix Sigma_x, such that Sigma = Sigma_x %*% t(Sigma_x)
chol
;
the option PCMBase.Transpose.Sigma_x
in PCMOptions
.
# S is a symmetric positive definite matrix M<-matrix(rexp(9),3,3); S <- M %*% t(M) # This should return a zero matrix: UpperTriFactor(S) %*% t(UpperTriFactor(S)) - S#> [,1] [,2] [,3] #> [1,] 0 0 0 #> [2,] 0 0 0 #> [3,] 0 0 0#> [,1] [,2] [,3] #> [1,] -4.440892e-16 0 0 #> [2,] 0.000000e+00 0 0 #> [3,] 0.000000e+00 0 0# Unless S is diagonal, in the general case, this will return a # non-zero matrix: chol(S) %*% t(chol(S)) - S#> [,1] [,2] [,3] #> [1,] 10.202674 -3.055276 -1.745188 #> [2,] -3.055276 -7.784033 -4.275878 #> [3,] -1.745188 -4.275878 -2.418641