dsCMatrix-class {Matrix} | R Documentation |
The dsCMatrix
class is a class of symmetric, sparse
numeric matrices in the compressed, column-oriented format. In
this implementation the non-zero elements in the columns are sorted
into increasing row order.
The dsTMatrix
class is the class of symmetric, sparse numeric
matrices in triplet format.
Objects can be created by calls of the form new("dsCMatrix",
...)
or new("dsTMatrix", ...)
, or automatically via e.g.,
as(*, "symmetricMatrix")
, or (for dsCMatrix
) also
from Matrix(.)
.
Creation “from scratch” most efficiently happens via
sparseMatrix(*, symmetric=TRUE)
.
uplo
:A character object indicating if the upper
triangle ("U"
) or the lower triangle ("L"
) is stored.
i
:Object of class "integer"
of length nnZ
(half number of non-zero elements). These are the row
numbers for each non-zero element in the lower triangle of the matrix.
p
:(only in class "dsCMatrix"
:) an
integer
vector for providing pointers, one for each
column, see the detailed description in CsparseMatrix
.
j
:(only in class "dsTMatrix"
:) Object of
class "integer"
of length nnZ (as i
). These are the
column numbers for each non-zero element in the lower triangle of
the matrix.
x
:Object of class "numeric"
of length nnZ –
the non-zero elements of the matrix (to be duplicated for full matrix).
factors
:Object of class "list"
- a list
of factorizations of the matrix.
Dim
:Object of class "integer"
- the dimensions
of the matrix - must be an integer vector with exactly two
non-negative values.
Both classes extend classes and symmetricMatrix
dsparseMatrix
directly;
dsCMatrix
further directly extends
CsparseMatrix
, where
dsTMatrix
does TsparseMatrix
.
signature(a = "dsCMatrix", b = "....")
: x
<- solve(a,b)
solves A x = b for x; see
solve-methods
.
signature(x = "dsCMatrix", pivot = "logical")
:
Returns (and stores) the Cholesky decomposition of x
, see
chol
.
signature(A = "dsCMatrix",...)
:
Computes more flexibly Cholesky decompositions,
see Cholesky
.
signature(x = "dsCMatrix", logarithm =
"missing")
: Evaluate the determinant of x
on the
logarithm scale. This creates and stores the Cholesky factorization.
signature(x = "dsCMatrix", logarithm =
"logical")
: Evaluate the determinant of x
on the
logarithm scale or not, according to the logarithm
argument. This creates and stores the Cholesky factorization.
signature(x = "dsCMatrix")
: Transpose. As for all
symmetric matrices, a matrix for which the upper triangle is
stored produces a matrix for which the lower triangle is stored
and vice versa, i.e., the uplo
slot is swapped, and the row
and column indices are interchanged.
signature(x = "dsTMatrix")
: Transpose. The
uplo
slot is swapped from "U"
to "L"
or vice
versa, as for a "dsCMatrix"
, see above.
signature(from = "dsCMatrix", to = "dgTMatrix")
signature(from = "dsCMatrix", to = "dgeMatrix")
signature(from = "dsCMatrix", to = "matrix")
signature(from = "dsTMatrix", to = "dgeMatrix")
signature(from = "dsTMatrix", to = "dsCMatrix")
signature(from = "dsTMatrix", to = "dsyMatrix")
signature(from = "dsTMatrix", to = "matrix")
Classes dgCMatrix
, dgTMatrix
,
dgeMatrix
and those mentioned above.
mm <- Matrix(toeplitz(c(10, 0, 1, 0, 3)), sparse = TRUE) mm # automatically dsCMatrix str(mm) ## how would we go from a manually constructed Tsparse* : mT <- as(mm, "dgTMatrix") ## Either (symM <- as(mT, "symmetricMatrix"))# dsT (symC <- as(symM, "CsparseMatrix"))# dsC ## or sC <- Matrix(mT, sparse=TRUE, forceCheck=TRUE) sym2 <- as(symC, "TsparseMatrix") ## --> the same as 'symM', a "dsTMatrix"