QR {QR}R Documentation

QR factorization without pivoting

Description

This function performs QR factorization without pivoting to a numeric matrix A.

Usage

QR(A, complete = FALSE)

Arguments

A

a numeric matrix whose QR decomposition is to be computed.

complete

boolean that indicates if the R matrix should be completed with 0s to its full rank.

Details

This method is an alternative to the default qr function of base R. The default function returns a pivoted solution in many cases, which is not always the desired solution. In this function, we returned the unpivoted solution for the QR factorization using the LAPACK routine DGEQRF. Currently, the function only works for real numbers.

Value

Returns a list with the following components:

qr

a matrix with the same dimensions as A. The upper triangle contains the R of the decomposition and the lower triangle contains information on the Q of the decomposition (stored in compact form).

qraux

a vector of length ncol(A) which contains additional information on Q.

Q

an orthogonal matrix such that Q*R is the input matrix.

R

an upper triangular matrix such that Q*R is the input matrix.

Source

LAPACK routine DGEQRF is used for the QR factorization without pivoting.

References

Anderson. E. and ten others (1999) LAPACK Users' Guide. Third Edition. SIAM. Available on-line at http://www.netlib.org/lapack/lug/lapack_lug.html.

Examples


set.seed(2)
A<-matrix(sample(-20:20, size = 25, replace = TRUE),5,5)
qres<-QR(A)

#Inspect the main results of the factorization:
qres$Q
qres$R


[Package QR version 0.1.3 Index]