diagU2N {Matrix} | R Documentation

## 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.

### Details

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

### Value

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

### Note

Such internal storage details should rarely be of relevance to the user. Hence, these functions really are rather internal utilities.

### See Also

`"triangularMatrix"`, `"dtCMatrix"`.

### Examples

    (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)))

[Package Matrix version 1.0-6 Index]