Function qrfac
This subroutine uses Householder transformations with column pivoting (optional) to compute a QR factorization of the m by n matrix A. That is, qrfac determines an orthogonal matrix Q, a permutation matrix P, and an upper trapezoidal matrix R with diagonal elements of nonincreasing magnitude, such that AP = QR. The Householder transformation for column k, k = 1,2,...,min(m,n), is of the form
void qrfac(Real)
(
size_t m,
size_t n,
Real* a,
size_t lda,
bool pivot,
size_t* ipvt,
size_t lipvt,
Real* rdiag,
Real* acnorm,
Real* wa
);
t
i - (1/u(k)) u u
where u has zeros in the first k-1 positions. The form of this transformation and the method of pivoting first appeared in the corresponding LINPACK subroutine.
Parameters
Name | Description |
---|---|
m | a positive integer input variable set to the number of rows of a. |
n | a positive integer input variable set to the number of columns of a. |
a | an m by n array. on input a contains the matrix for which the qr factorization is to be computed. on output the strict upper trapezoidal part of a contains the strict upper trapezoidal part of r, and the lower trapezoidal part of a contains a factored form of q (the non-trivial elements of the u vectors described above). |
lda | a positive integer input variable not less than m which specifies the leading dimension of the array a. |
pivot | a logical input variable. if pivot is set true, then column pivoting is enforced. if pivot is set false, then no column pivoting is done. |
ipvt | an integer output array of length lipvt. ipvt defines the permutation matrix p such that a*p = q*r. column j of p is column ipvt(j) of the identity matrix. if pivot is false, ipvt is not referenced. |
lipvt | a positive integer input variable. if pivot is false, then lipvt may be as small as 1. if pivot is true, then lipvt must be at least n. |
rdiag | an output array of length n which contains the diagonal elements of r. |
acnorm | an output array of length n which contains the norms of the corresponding columns of the input matrix a. if this information is not needed, then acnorm can coincide with rdiag. |
wa | a work array of length n. if pivot is false, then wa can coincide with rdiag. |