dtrMatrix-class | R Documentation |
The "dtrMatrix"
class is the class of triangular, dense,
numeric matrices in nonpacked storage. The "dtpMatrix"
class
is the same except in packed storage, see pack()
.
Objects can be created by calls of the form new("dtrMatrix", ...)
.
uplo
:Object of class "character"
. Must be
either "U", for upper triangular, and "L", for lower triangular.
diag
:Object of class "character"
. Must be
either "U"
, for unit triangular (diagonal is all ones), or
"N"
; see triangularMatrix
.
x
:Object of class "numeric"
. The numeric
values that constitute the matrix, stored in column-major order.
Dim
:Object of class "integer"
. The dimensions
of the matrix which must be a two-element vector of non-negative
integers.
Class "ddenseMatrix"
, directly.
Class "triangularMatrix"
, directly.
Class "Matrix"
and others, by class "ddenseMatrix"
.
Among others (such as matrix products, e.g. ?crossprod-methods
),
signature(x = "dtrMatrix", type = "character")
: ..
signature(x = "dtrMatrix", norm = "character")
: ..
signature(a = "dtrMatrix", b = "....")
: efficiently
use a “forwardsolve” or backsolve
for a lower or
upper triangular matrix, respectively, see also
solve-methods
.
all the Ops
group
methods are available. When applied to two triangular matrices,
these return a triangular matrix when easily possible.
Classes ddenseMatrix
, dtpMatrix
,
triangularMatrix
(m <- rbind(2:3, 0:-1))
(M <- as(m, "generalMatrix"))
(T <- as(M, "triangularMatrix")) # formally upper triangular
(T2 <- as(t(M), "triangularMatrix"))
stopifnot(T@uplo == "U", T2@uplo == "L", identical(T2, t(T)))
m <- matrix(0,4,4); m[upper.tri(m)] <- 1:6
(t1 <- Matrix(m+diag(,4)))
str(t1p <- pack(t1))
(t1pu <- diagN2U(t1p))
stopifnot(exprs = {
inherits(t1 , "dtrMatrix"); validObject(t1)
inherits(t1p, "dtpMatrix"); validObject(t1p)
inherits(t1pu,"dtCMatrix"); validObject(t1pu)
t1pu@x == 1:6
all(t1pu == t1p)
identical((t1pu - t1)@x, numeric())# sparse all-0
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.