Symmetric Dense Nonzero-Pattern Matrices
nsyMatrix-class.RdThe "nsyMatrix" class is the class of symmetric, dense nonzero-pattern
matrices in non-packed storage and "nspMatrix" is the class of
of these in packed storage. Only the upper triangle or the
lower triangle is stored.
Slots
uplo:Object of class
"character". Must be either "U", for upper triangular, and "L", for lower triangular.x:Object of class
"logical". The logical values that constitute the matrix, stored in column-major order.Dim,Dimnames:The dimension (a length-2
"integer") and corresponding names (orNULL), see theMatrixclass.factors:Object of class
"list". A named list of factorizations that have been computed for the matrix.
Extends
"nsyMatrix" extends class "ngeMatrix", directly, whereas"nspMatrix" extends class "ndenseMatrix", directly.
Both extend class "symmetricMatrix", directly,
and class "Matrix" and others, indirectly, use
showClass("nsyMatrix"), e.g., for details.
Methods
Currently, mainly t() and coercion methods (for
as(.); use, e.g.,
showMethods(class="nsyMatrix") for details.
Examples
(s0 <- new("nsyMatrix"))
#> 0 x 0 Matrix of class "nsyMatrix"
#> <0 x 0 matrix>
(M2 <- Matrix(c(TRUE, NA, FALSE, FALSE), 2, 2)) # logical dense (ltr)
#> 2 x 2 Matrix of class "ltrMatrix"
#> [,1] [,2]
#> [1,] TRUE .
#> [2,] NA FALSE
(sM <- M2 & t(M2)) # -> "lge"
#> 2 x 2 Matrix of class "lgeMatrix"
#> [,1] [,2]
#> [1,] TRUE FALSE
#> [2,] FALSE FALSE
class(sM <- as(sM, "nMatrix")) # -> "nge"
#> [1] "ngeMatrix"
#> attr(,"package")
#> [1] "Matrix"
(sM <- as(sM, "symmetricMatrix")) # -> "nsy"
#> 2 x 2 Matrix of class "nsyMatrix"
#> [,1] [,2]
#> [1,] TRUE FALSE
#> [2,] FALSE FALSE
str(sM <- as(sM, "packedMatrix")) # -> "nsp", i.e., packed symmetric
#> Formal class 'nspMatrix' [package "Matrix"] with 5 slots
#> ..@ uplo : chr "U"
#> ..@ Dim : int [1:2] 2 2
#> ..@ Dimnames:List of 2
#> .. ..$ : NULL
#> .. ..$ : NULL
#> ..@ x : logi [1:3] TRUE FALSE FALSE
#> ..@ factors : list()