Learn R Programming

Matrix (version 1.2-8)

dsyMatrix-class: Symmetric Dense Numeric Matrices

Description

The "dsyMatrix" class is the class of symmetric, dense matrices in non-packed storage and "dspMatrix" is the class of symmetric dense matrices in packed storage. Only the upper triangle or the lower triangle is stored.

Arguments

Objects from the Class

Objects can be created by calls of the form new("dsyMatrix", ...).

Slots

Extends

"dsyMatrix" extends class "dgeMatrix", directly, whereas "dspMatrix" extends class "ddenseMatrix", directly. Both extend class "symmetricMatrix", directly, and class "Matrix" and others, indirectly, use showClass("dsyMatrix"), e.g., for details.

Methods

See Also

Classes dgeMatrix and Matrix; solve, norm, rcond, t

Examples

Run this code
## Only upper triangular part matters (when uplo == "U" as per default)
(sy2 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, NA,32,77)))
str(t(sy2)) # uplo = "L", and the lower tri. (i.e. NA is replaced).

chol(sy2) #-> "Cholesky" matrix
(sp2 <- pack(sy2)) # a "dspMatrix"

## Coercing to dpoMatrix gives invalid object:
sy3 <- new("dsyMatrix", Dim = as.integer(c(2,2)), x = c(14, -1, 2, -7))
try(as(sy3, "dpoMatrix")) # -> error: not positive definite

Run the code above in your browser using DataLab