IMSL_QRFAC

Syntax | Arguments | Keywords | Discussion | Example | Errors | Version History

The IMSL_QRFAC procedure computes the QR factorization of a real matrix A.

Note
This routine requires an IDL Advanced Math and Stats license. For more information, contact your ITT Visual Information Solutions sales or technical support representative.

Syntax

IMSL_QRFAC, a [, pivot [, auxqr, qr] [, AP=variable] [, BASIS=variable] [, /DOUBLE] [, Q=variable] [, R=variable] [, TOLERANCE=value]]

Arguments

a

A two-dimensional matrix containing the coefficient matrix. Element A(i,j) contains the j-th coefficient of the i-th equation.

pivot

A one-dimensional matrix containing the desired variable order and usage information.

auxqr

Matrix containing the scalars τk of the Householder transformations that define the decomposition.

qr

Matrix containing the Householder transformations that define the decomposition.

Keywords

AP

Named variable into which the product AP of the identity AP = QR is stored. This keyword is useful when attempting to compute the residual AP – QR.

BASIS

Named variable into which an integer containing the number of columns used in the solution is stored. The value BASIS = k, if |rk,k| < TOLERANCE*|r0,0| and |ri,i| ≥ TOLERANCE*|r0,0| for i = 0, 1, ..., k – 1. For more information, see Discussion.

DOUBLE

If present and nonzero, double precision is used.

Q

Named variable in which the two-dimensional matrix containing the orthogonal matrix of the AP = QR factorization is stored.

R

Named variable in which the two-dimensional matrix containing the upper-triangular matrix of the AP = QR decomposition is stored.

TOLERANCE

Nonnegative tolerance used to determine the subset of columns of A to be included in the solution. Default: TOLERANCE = SQRT(ε), where ε is machine precision

Discussion

The IMSL_QRFAC procedure computes a QR factorization of the matrix AP, where P is the permutation matrix defined by the pivoting and computes the smallest integer k satisfying |rk,k| < TOLERANCE*|r0,0| to the keyword BASIS.

Householder transformations:

Qk = I – τkukukT, k = 0, ..., min(m – 1, n) – 1

compute the factorization. The decomposition is computed in the form Qmin (m – 1, n) – 1 ... Q0AP = R, so AP = QR where Q = Q0 ... Qmin (m – 1, n) – 1. Since each Householder vector uk has zeros in the first k + 1 entries, it is stored as part of column k of QR. The upper-trapezoidal matrix R is stored in the upper-trapezoidal part of the first min(m, n) rows of QR.

When computing the factorization, the procedure computes the QR factorization of AP with P defined by the input pivot and by column pivoting among "free" columns. Before the factorization, initial columns are moved to the beginning of the array A and the final columns to the end. Neither initial nor final columns are permuted further during the computation. Only the free columns are moved.

Example

Using the same data as the first example given for the IMSL_QRSOL function, this sample computes the QR factorization of the coefficient. Using keywords, the factorization is returned in the full matrices, rather than the default condensed format.

RM, a, 4, 3 
; Define the coefficient matrix. 
row 0:  1 2 4 
row 1:  1 4 16 
row 2:  1 6 36 
row 3:  1 8 64 
IMSL_QRFAC, a, pvt, Q = q, R = r, AP = ap 
; Call IMSL_QRFAC using keywords Q, R, and AP. 
PM, q, Title = 'Q', Format = '(4f12.6)' 
; Output the results. 
Q 
   -0.053149   -0.542171    0.808224   -0.223607 
   -0.212598   -0.657436   -0.269408    0.670820 
   -0.478345   -0.345794   -0.449013   -0.670820 
   -0.850390    0.392754    0.269408    0.223607 
 
PM, r, Title = 'R', Format = '(3f12.6)' 
R 
   -75.259552  -10.629880   -1.594482 
     0.000000   -2.646819   -1.152647 
     0.000000    0.000000    0.359211 
     0.000000    0.000000    0.000000 
 
PM, pvt, Title = 'Pvt' 
Pvt 
   3 
   2 
   1 
 
 
 
 
PM, q # r - ap, Title = 'Residual', Format = '(3f12.6)' 
Residual 
   -0.000004   -0.000001   -0.000000 
    0.000000   -0.000000    0.000000 
    0.000000   -0.000000   -0.000000 
    0.000000   -0.000000   -0.000000 
 

Errors

Fatal Errors

MATH_SINGULAR_TRI_MATRIX—Input triangular matrix is singular. The index of the first zero diagonal term is #.

Version History

6.4

Introduced