Learn R Programming

QR (version 0.1.3)

QRcomp: QR factorization without pivoting

Description

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

Usage

QRcomp(A, complete = FALSE)

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.

Arguments

A

a complex 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 ZGEQRF. This function works with real and complex matrices.

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

Run this code

set.seed(2)
A<-matrix(c(complex(real=1,imaginary = 1),
complex(real=3,imaginary = -2), complex(real=2,imaginary = 1),
complex(real=0,imaginary = 3)),2,2)
qres<-QRcomp(A)

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

Run the code above in your browser using DataLab