nag_real_apply_q (f01qdc) (PDF version)
f01 Chapter Contents
f01 Chapter Introduction
NAG Library Manual

NAG Library Function Document

nag_real_apply_q (f01qdc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_real_apply_q (f01qdc) performs one of the transformations
B : = QB   or   B : = QT B ,
where B  is an m  by ncolb  real matrix and Q  is an m  by m  orthogonal matrix, given as the product of Householder transformation matrices.
This function is intended for use following nag_real_qr (f01qcc).

2  Specification

#include <nag.h>
#include <nagf01.h>
void  nag_real_apply_q (MatrixTranspose trans, Nag_WhereElements wheret, Integer m, Integer n, double a[], Integer tda, const double zeta[], Integer ncolb, double b[], Integer tdb, NagError *fail)

3  Description

Q  is assumed to be given by
Q = Q n Q n-1 Q 1 T ,
Q k  being given in the form
Q k = I 0 0 T k ,
where
T k = I - u k ukT ,
u k = ζ k z k ,
ζ k  is a scalar and z k  is an m-k  element vector. z k  must be supplied in the k-1 th column of a in elements a[k×tda+k-1] , , a[m-1×tda+k-1]  and ζ k  must be supplied either in a[k-1×tda+k-1]  or in zeta[k-1] , depending upon the argument wheret.
To obtain Q  explicitly B  may be set to I  and premultiplied by Q . This is more efficient than obtaining QT .

4  References

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:     transMatrixTranspose Input
On entry: the operation to be performed as follows:
  • trans=NoTranspose, perform the operation B : = QB .
  • trans=Transpose or ConjugateTranspose, perform the operation B : = QT B .
Constraint: trans must be one of NoTranspose, Transpose or ConjugateTranspose.
2:     wheretNag_WhereElementsInput
On entry: indicates where the elements of ζ  are to be found as follows:
  • wheret=Nag_ElementsIn, the elements of ζ  are in a.
  • wheret=Nag_ElementsSeparate the elements of ζ  are separate from a, in zeta.
Constraint: wheret=Nag_ElementsIn or Nag_ElementsSeparate.
3:     mIntegerInput
On entry: m , the number of rows of A .
Constraint: mn .
4:     nIntegerInput
On entry: n , the number of columns of A .
When n=0  then an immediate return is effected.
Constraint: n0 .
5:     a[m×tda]doubleInput
On entry: the leading m  by n  strictly lower triangular part of the array a must contain details of the matrix Q . In addition, when wheret=Nag_ElementsIn, then the diagonal elements of a must contain the elements of ζ  as described under the argument zeta. When wheret=Nag_ElementsSeparate, the diagonal elements of the array a are referenced, since they are used temporarily to store the ζ k , but they contain their original values on return.
6:     tdaIntegerInput
On entry: the stride separating matrix column elements in the array a.
Constraint: tdan .
7:     zeta[n]const doubleInput
On entry: if wheret=Nag_ElementsSeparate, the array zeta must contain the elements of ζ . If zeta[k-1] = 0.0  then T k  is assumed to be I  otherwise zeta[k-1]  is assumed to contain ζ k . When wheret=Nag_ElementsIn, zeta is not referenced and may be NULL
8:     ncolbIntegerInput
On entry: ncolb , the number of columns of B .
When ncolb=0  then an immediate return is effected.
Constraint: ncolb0 .
9:     b[m×tdb]doubleInput/Output
Note: the i,jth element of the matrix B is stored in b[i-1×tdb+j-1].
On entry: the leading m  by ncolb  part of the array b must contain the matrix to be transformed.
On exit: b is overwritten by the transformed matrix.
10:   tdbIntegerInput
On entry: the stride separating matrix column elements in the array b.
Constraint: tdbncolb .
11:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_2_INT_ARG_LT
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, tdb=value  while ncolb=value . These arguments must satisfy tdbncolb .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument trans had an illegal value.
On entry, argument wheret had an illegal value.
NE_INT_ARG_LT
On entry, n=value.
Constraint: n0.
On entry, ncolb=value.
Constraint: ncolb0.

7  Accuracy

Letting C  denote the computed matrix QT B , C  satisfies the relation
QC = B + E
where E c ε B , ε  is the machine precision, c  is a modest function of m  and .  denotes the spectral (two) norm. An equivalent result holds for the computed matrix QB . See also Section 9.

8  Parallelism and Performance

Not applicable.

9  Further Comments

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

10  Example

To obtain the matrix QT B  for the matrix B  given by
B = 1.10 0.00 0.90 0.00 0.60 1.32 0.00 1.10 -0.80 -0.26
following the QR  factorization of the 5 by 3 matrix A  given by
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 (f01qdce.c)

10.2  Program Data

Program Data (f01qdce.d)

10.3  Program Results

Program Results (f01qdce.r)


nag_real_apply_q (f01qdc) (PDF version)
f01 Chapter Contents
f01 Chapter Introduction
NAG Library Manual

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