lq: LQ decomposition.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Computes the LQ decomposition of a matrix.

Usage

1
lq(X)

Arguments

X

A n by p matrix of rank n.

Details

If X is an n by p matrix with n ≤ p, then lq computes the LQ decomposition of X. That is, X = LQ' where Q is p by n with orthonormal columns and L is n by n lower triangular with positive diaognal entries.

Value

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

Q An n by p 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

1
2
3
4
5
6
7
8
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))


Search within the tensr package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.