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

                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.

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
)

Parameters

m size_t

a positive integer input variable set to the number of rows of a.

n size_t

a positive integer input variable set to the number of columns of a.

a Real*

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 size_t

a positive integer input variable not less than m which specifies the leading dimension of the array a.

pivot bool

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 size_t*

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 size_t

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 Real*

an output array of length n which contains the diagonal elements of r.

acnorm Real*

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 Real*

a work array of length n. if pivot is false, then wa can coincide with rdiag.

Meta