QREcon: QREcon - Economical QR decomposition

Description Usage Arguments Value Examples

Description

QREcon - Economical QR decomposition

Usage

1
QREcon(x, q, r)

Arguments

x

The matrix to decompose. This must be a numeric matrix. The number or rows in X must be greater than of equal to the number of columns in X.

q

(Optional) A numeric matrix that will contain the Q matrix after decompostion. If this value is passed to the function it must have the same number of rows and columns as the x matrix If this value is provided a value for r must be provided.

r

(Optional) A numeric matrix that will contain the R matrix after decomposition. If this value is provided is must be a square matrix with the number of rows and columns equal to the number of columns in the x matrix. If this value is provided a value for q must be provided.

Value

If q and r are not provided, a list with q and r will be returned. This will contain the Q and R matrices from the QR decomposition of x. If these matrices are NULL, the decomposition of x failed. If q and r are provided and are of the appropriate dimenstions, a value of 0 will be returned if the decomposition was successful and the q and r will contain the Q and R matrices from the decomposition of x, otherwise a value of 1 will be returned.

Examples

1
2
3
4
5
6
x <- matrix(c(1.,1.,1.,2.,3.,5.), 3, 2)
qr <- QREcon(x)
qr$q
qr$r
qr$q %*% qr$r
t(qr$q) %*% qr$q

jimb3/QREcon documentation built on May 7, 2019, 6:08 a.m.