Learn R Programming

Matrix (version 1.0-4)

diagU2N: Transform Triangular Matrices from Unit Triangular to General and back

Description

Transform a triangular matrix x, i.e., of class "triangularMatrix", from (internally!) unit triangular (unitriangular) to general (diagU2N(x)) or back (diagN2U(x)).

Usage

diagN2U(x, cl = getClassDef(class(x)))
 diagU2N(x, cl = getClassDef(class(x)), checkDense = FALSE)
.diagU2N(x, cl, checkDense = FALSE)

Arguments

x
a triangularMatrix, often sparse.
cl
(optional, for speedup only:) class (definition) of x.
checkDense
logical indicating if dense (see denseMatrix) matrices should be considered at all.

Value

  • a triangular matrix of the same class and (semantically) with identical entries as x, but with a different diag slot.

Details

The concept of unit triangular matrices with a diag slot of "U" stems from LAPACK.

See Also

"triangularMatrix", "dtCMatrix".

Examples

Run this code
(T <- Diagonal(7) + triu(Matrix(rpois(49, 1/4), 7,7), k = 1))
(uT <- diagN2U(T)) # "unitriangular"
stopifnot(all(T == uT),
          identical(T, diagU2N(uT)))

Run the code above in your browser using DataLab