nag_real_qr (f01qcc) (PDF version)
f01 Chapter Contents
f01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_real_qr (f01qcc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_real_qr (f01qcc) finds the QR  factorization of the real m  by n  matrix A , where mn .

2  Specification

#include <nag.h>
#include <nagf01.h>
void  nag_real_qr (Integer m, Integer n, double a[], Integer tda, double zeta[], NagError *fail)

3  Description

The m  by n  matrix A  is factorized as
A = Q R 0 when ​ m > n , A = QR when ​ m = n ,
where Q  is an m  by m  orthogonal matrix and R  is an n  by n  upper triangular matrix. The factorization is obtained by Householder's method. The k th transformation matrix, Q k , which is used to introduce zeros into the k th column of A  is given in the form
Q k = I 0 0 T k
T k = I - u k ukT ,
u k = ζ k z k ,
ζ k  is a scalar and z k  is an m-k  element vector. ζ k  and z k  are chosen to annihilate the elements below the triangular part of A .
The vector u k  is returned in the k-1 th element of the array zeta and in the k-1 th column of a, such that ζ k  is in zeta[k-1]  and the elements of z k  are in a[k×tda+k-1] , , a[m-1×tda+k-1] . The elements of R  are returned in the upper triangular part of a. Q  is given by
Q = Q n Q n-1 Q 1 T .
Good background descriptions to the QR  factorization are given in Dongarra et al. (1979) and Golub and Van Loan (1996).

4  References

Dongarra J J, Moler C B, Bunch J R and Stewart G W (1979) LINPACK Users' Guide SIAM, Philadelphia
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Wilkinson J H (1965) The Algebraic Eigenvalue Problem Oxford University Press, Oxford

5  Arguments

1:     mIntegerInput
On entry: m , the number of rows of A .
Constraint: mn .
2:     nIntegerInput
On entry: n , the number of columns of A .
When n=0  then an immediate return is effected.
Constraint: n0 .
3:     a[m×tda]doubleInput/Output
On entry: the leading m  by n  part of the array a must contain the matrix to be factorized.
On exit: the n  by n  upper triangular part of a will contain the upper triangular matrix R  and the m  by n  strictly lower triangular part of a will contain details of the factorization as described in Section 3
4:     tdaIntegerInput
On entry: the stride separating matrix column elements in the array a.
Constraint: tdan .
5:     zeta[n]doubleOutput
On exit: zeta[k-1]  contains the scalar ζ k  for the k th transformation. If T k = I  then zeta k-1 = 0.0 , otherwise zeta[k-1]  contains ζ k  as described in Section 3 and ζ k  is always in the range 1.0 , 2.0 .
6:     failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

On entry, m=value  while n=value . These arguments must satisfy mn .
On entry, tda=value  while n=value . These arguments must satisfy tdan .
On entry, n=value.
Constraint: n0.

7  Accuracy

The computed factors Q  and R  satisfy the relation
Q R 0 = A + E
where E c ε A , and ε  is the machine precision, c  is a modest function of m  and n  and .  denotes the spectral (two) norm.

8  Parallelism and Performance

Not applicable.

9  Further Comments

The approximate number of floating-point operations is given by 2 n 2 3 m - n / 3 .

10  Example

To obtain the QR  factorization of the 5 by 3 matrix
A = 2.0 2.5 2.5 2.0 2.5 2.5 1.6 -0.4 2.8 2.0 -0.5 0.5 1.2 -0.3 -2.9 .

10.1  Program Text

Program Text (f01qcce.c)

10.2  Program Data

Program Data (f01qcce.d)

10.3  Program Results

Program Results (f01qcce.r)

nag_real_qr (f01qcc) (PDF version)
f01 Chapter Contents
f01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2014