
Last chance! 50% off unlimited learning
Sale ends in
"dpoMatrix"
class is the class of
positive-semidefinite symmetric matrices in nonpacked storage.
The "dppMatrix"
class is the same except in packed storage.
Only the upper triangle or the lower triangle is required to be
available. The "corMatrix"
class extends "dpoMatrix"
with a slot sd
.
new("dpoMatrix", ...)
or from crossprod
applied to
an "dgeMatrix"
object."dsyMatrix"
, directly.
Classes "dgeMatrix"
, "symmetricMatrix"
, and many more
by class "dsyMatrix"
.dsyMatrix
and dgeMatrix
;
further, Matrix
, rcond
,
chol
, solve
, crossprod
.h6 <- Hilbert(6)
rcond(h6)
str(h6)
h6 * 27720 # is ``integer''
solve(h6)
str(hp6 <- as(h6, "dppMatrix"))
### Note that as(*, "corMatrix") *scales* the matrix
(ch6 <- as(h6, "corMatrix"))
stopifnot(all.equal(h6 * 27720, round(27720 * h6), tolerance = 1e-14),
all.equal(ch6@sd^(-2), 2*(1:6)-1, tolerance= 1e-12))
chch <- chol(ch6)
stopifnot(identical(chch, ch6@factors$Cholesky),
all(abs(crossprod(chch) - ch6) < 1e-10))
Run the code above in your browser using DataLab