lq {tensr}R Documentation

LQ decomposition.

Description

Computes the LQ decomposition of a matrix.

Usage

lq(X)

Arguments

X

A nn by pp matrix of rank nn.

Details

If XX is an nn by pp matrix with npn \le p, then lq computes the LQ decomposition of XX. That is, X=LQX = LQ' where QQ is pp by nn with orthonormal columns and LL is nn by nn lower triangular with positive diaognal entries.

Value

L An nn by nn lower triangular matrix with positive diagonal entries.

Q An nn by pp matrix with orthonormal columns.

The returned values satisfy X = L %*% t(Q), up to numerical precision.

Author(s)

David Gerard.

See Also

qr2 for the related QR decomposition.

Examples

X <- matrix(stats::rnorm(12), nrow = 3)
lq_X <- lq(X)
L <- lq_X$L
Q <- lq_X$Q
L
Q
trim(t(Q) %*% Q)
trim(X - L%*%t(Q))

[Package tensr version 1.0.1 Index]