dsRMatrix-class.Rd
The dsRMatrix
class is a class of symmetric, sparse
matrices in the compressed, row-oriented format. In this
implementation the non-zero elements in the rows are sorted into
increasing column order.
These "..RMatrix"
classes are currently still mostly unimplemented!
Objects can be created by calls of the form new("dsRMatrix", ...)
.
uplo
:A character object indicating if the upper
triangle ("U"
) or the lower triangle ("L"
) is
stored. At present only the lower triangle form is allowed.
j
:Object of class "integer"
of length
nnzero
(number of non-zero elements). These are the row
numbers for each non-zero element in the matrix.
p
:Object of class "integer"
of pointers, one
for each row, to the initial (zero-based) index of elements in
the row.
factors
:Object of class "list"
- a list
of factorizations of the matrix.
x
:Object of class "numeric"
- the non-zero
elements of the matrix.
Dim
:Object of class "integer"
- the dimensions
of the matrix - must be an integer vector with exactly two
non-negative values.
Dimnames
:List of length two, see Matrix
.
Classes dsparseMatrix
,
symmetricMatrix
, and
RsparseMatrix
, directly.
Class "dMatrix"
, by class "dsparseMatrix"
;
class "sparseMatrix"
, by classes "dsparseMatrix"
and
"RsparseMatrix"
.
signature(x = "dsRMatrix", uplo = "missing")
:
a trivial method just returning x
signature(x = "dsRMatrix", uplo = "character")
:
if uplo == x@uplo
, this trivially returns x
;
otherwise t(x)
.
(m0 <- new("dsRMatrix"))
#> 0 x 0 sparse Matrix of class "dsRMatrix"
#> <0 x 0 matrix>
m2 <- new("dsRMatrix", Dim = c(2L,2L),
x = c(3,1), j = c(1L,1L), p = 0:2)
m2
#> 2 x 2 sparse Matrix of class "dsRMatrix"
#>
#> [1,] . 3
#> [2,] 3 1
stopifnot(colSums(as(m2, "TsparseMatrix")) == 3:4)
str(m2)
#> Formal class 'dsRMatrix' [package "Matrix"] with 7 slots
#> ..@ p : int [1:3] 0 1 2
#> ..@ j : int [1:2] 1 1
#> ..@ Dim : int [1:2] 2 2
#> ..@ Dimnames:List of 2
#> .. ..$ : NULL
#> .. ..$ : NULL
#> ..@ x : num [1:2] 3 1
#> ..@ uplo : chr "U"
#> ..@ factors : list()
(ds2 <- forceSymmetric(diag(2))) # dsy*
#> 2 x 2 Matrix of class "dsyMatrix"
#> [,1] [,2]
#> [1,] 1 0
#> [2,] 0 1
dR <- as(ds2, "RsparseMatrix")
dR # dsRMatrix
#> 2 x 2 sparse Matrix of class "dsRMatrix"
#>
#> [1,] 1 .
#> [2,] . 1