force_posiDiag | R Documentation |
This function ensures that the triangular matrix in a QR (or other) decomposition has positive values along its diagonal.
force_posiDiag(x)
x |
A matrix, which must be either upper-triangular or lower-triangular. |
An upper or lower triangular matrix with positive diagonal entries such that the matrix is still a valid decomposition of the matrix the input x
is a decomposition of.
Keefe Murphy - <keefe.murphy@mu.ie>
data(ais)
res <- MoE_clust(ais[,3:7], G=3, modelNames="EEE")
sig <- res$parameters$variance
a <- force_posiDiag(sig$cholSigma)
b <- chol(sig$Sigma)
all.equal(a, b) #TRUE
all.equal(crossprod(a), sig$Sigma) #TRUE
all.equal(crossprod(b), sig$Sigma) #TRUE
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.