R: Symmetric Dense Numeric Matrices

dsyMatrix-class {Matrix} | R Documentation

## 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.

### Objects from the Class

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

### Slots

`uplo`:

  Object of class `"character"`. Must be either "U", for upper triangular, and "L", for lower triangular.

`x`:

  Object of class `"numeric"`. The numeric values that constitute the matrix, stored in column-major order.

`Dim`,`Dimnames`:

  The dimension (a length-2 `"integer"`) and corresponding names (or `NULL`), see the `Matrix`.

`factors`:

  Object of class `"list"`. A named list of factorizations that have been computed for the matrix.

### 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

coerce

  `signature(from = "ddenseMatrix", to = "dgeMatrix")`

coerce

  `signature(from = "dspMatrix", to = "matrix")`

coerce

  `signature(from = "dsyMatrix", to = "matrix")`

coerce

  `signature(from = "dsyMatrix", to = "dspMatrix")`

coerce

  `signature(from = "dspMatrix", to = "dsyMatrix")`

norm

  `signature(x = "dspMatrix", type = "character")`, or `x = "dsyMatrix"` or `type = "missing"`: Computes the matrix norm of the desired type, see, `norm`.

rcond

  `signature(x = "dspMatrix", type = "character")`, or `x = "dsyMatrix"` or `type = "missing"`: Computes the reciprocal condition number, `rcond()`.

solve

  `signature(a = "dspMatrix", b = "....")`, and

solve

  `signature(a = "dsyMatrix", b = "....")`: `x <- solve(a,b)` solves A x = b for x; see `solve-methods`.

t

  `signature(x = "dsyMatrix")`: Transpose; swaps from upper triangular to lower triangular storage, i.e., the uplo slot from `"U"` to `"L"` or vice versa, the same as for all symmetric matrices.

### See Also

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

### Examples

    ## 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

[Package Matrix version 1.1-4 Index]