"dtrMatrix" class is the class of triangular, dense,
numeric matrices in nonpacked storage. The "dtpMatrix" class
is the same except in packed storage.
new("dtrMatrix", ...).uplo:"character". Must be
either "U", for upper triangular, and "L", for lower triangular.diag:"character". Must be
either "U", for unit triangular (diagonal is all ones), or
"N"; see triangularMatrix.x:"numeric". The numeric
values that constitute the matrix, stored in column-major order.Dim:"integer". The dimensions
of the matrix which must be a two-element vector of non-negative
integers."ddenseMatrix", directly.
Class "triangularMatrix", directly.
Class "Matrix" and others, by class "ddenseMatrix".?crossprod-methods),
signature(from = "dgeMatrix", to = "dtrMatrix")signature(from = "dtrMatrix", to = "matrix")signature(from = "dtrMatrix", to = "ltrMatrix")signature(from = "dtrMatrix", to = "matrix")signature(from = "matrix", to = "dtrMatrix")signature(x = "dtrMatrix", type = "character")signature(x = "dtrMatrix", norm = "character")signature(a = "dtrMatrix", b = "....")backsolve for a lower or
upper triangular matrix, respectively, see also
solve-methods.
Ops group
methods are available. When applied to two triangular matrices,
these return a triangular matrix when easily possible.new("dtRMatrix", ...).uplo:"character". Must be
either "U", for upper triangular, and "L", for lower triangular.
At present only the lower triangle form is allowed.diag:"character". Must be
either "U", for unit triangular (diagonal is all ones), or
"N"; see triangularMatrix.j:"integer" of length
nnzero(.) (number of non-zero elements). These are
the row numbers for each non-zero element in the matrix.p:"integer" of pointers, one
for each row, to the initial (zero-based) index of elements in
the row. (Only present in the dsRMatrix class.)x:"numeric" - the non-zero
elements of the matrix.Dim:"integer")Dimnames:NULL),
inherited from the Matrix, see there."dgRMatrix", directly.
Class "dsparseMatrix", by class "dgRMatrix".
Class "dMatrix", by class "dgRMatrix".
Class "sparseMatrix", by class "dgRMatrix".
Class "Matrix", by class "dgRMatrix".ddenseMatrix, dtpMatrix,
triangularMatrix
(m <- rbind(2:3, 0:-1))
(M <- as(m, "dgeMatrix"))
(T <- as(M, "dtrMatrix")) ## upper triangular is default
(T2 <- as(t(M), "dtrMatrix"))
stopifnot(T@uplo == "U", T2@uplo == "L", identical(T2, t(T)))
Run the code above in your browser using DataLab