Title: | QR Factorization without Pivoting |
---|---|
Description: | This function performs QR factorization without pivoting to a real or complex matrix. It is based on Anderson. E. and ten others (1999) "LAPACK Users' Guide". Third Edition. SIAM. |
Authors: | Juan Claramunt Gonzalez [aut, cre, cph] |
Maintainer: | Juan Claramunt Gonzalez <[email protected]> |
License: | GPL-3 |
Version: | 0.1.3 |
Built: | 2024-11-20 06:55:43 UTC |
Source: | CRAN |
This function performs QR factorization without pivoting to a numeric matrix A.
QR(A, complete = FALSE)
QR(A, complete = FALSE)
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. |
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.
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. |
LAPACK routine DGEQRF is used for the QR factorization without pivoting.
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.
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
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
This function performs QR factorization without pivoting to a complex matrix A.
QRcomp(A, complete = FALSE)
QRcomp(A, complete = FALSE)
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. |
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.
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. |
LAPACK routine ZGEQRF is used for the QR factorization without pivoting.
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.
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
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