dpoMatrix-class {Matrix} | R Documentation |
The "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
.
Objects can be created by calls of the
form new("dpoMatrix", ...)
or from crossprod
applied to
an "dgeMatrix"
object.
uplo
:"character"
. Must be
either "U", for upper triangular, and "L", for lower triangular.x
:"numeric"
. The numeric
values that constitute the matrix, stored in column-major order.Dim
:"integer"
. The dimensions
of the matrix which must be a two-element vector of non-negative
integers.Dimnames
:"Matrix"
factors
:"list"
. A named
list of factorizations that have been computed for the matrix.sd
:"corMatrix"
) a numeric
vector of length n
containing the (original)
sqrt(var(.)) entries which allow
reconstruction of a covariance matrix from the correlation matrix.
Class "dsyMatrix"
, directly.
Classes "dgeMatrix"
, "symmetricMatrix"
, and many more
by class "dsyMatrix"
.
signature(x = "dpoMatrix")
:
Returns (and stores) the Cholesky decomposition of x
, see
chol
.signature(x = "dpoMatrix", norm = "character")
:
Returns (and stores) the reciprocal of the condition number of
x
. The norm
can be "O"
for the
one-norm (the default) or "I"
for the infinity-norm. For
symmetric matrices the result does not depend on the norm.signature(a = "dpoMatrix", b = "missing")
:
Return the inverse of a
.signature(a = "dpoMatrix", b = "numeric")
:
Solve the linear system defined by a
and b
, where
b
can be a numeric vector, or a matrix, or a dgeMatrix
object. The Cholesky decomposition of a
is calculated (if
needed) while solving the system.
Classes dsyMatrix
and dgeMatrix
;
further, Matrix
, rcond
,
chol
, solve
, crossprod
.
h6 <- Hilbert(6) rcond(h6) str(h6) solve(h6) str(hp6 <- as(h6, "dppMatrix")) ### Note that as(*, "corMatrix") *scales* the matrix (ch6 <- as(h6, "corMatrix")) stopifnot(all.equal(ch6@sd^(-2), 2*(1:6)-1, tol= 1e-12)) chch <- chol(ch6) stopifnot(identical(chch, ch6@factors$Cholesky), all(abs(crossprod(chch) - ch6) < 1e-10))