NAG Library Routine Document

f01qkf  (real_gen_rq_formq)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

f01qkf returns the first  rows of the real n by n orthogonal matrix PT, where P is given as the product of Householder transformation matrices.
This routine is intended for use following f01qjf.

2
Specification

Fortran Interface
Subroutine f01qkf ( wheret, m, n, nrowp, a, lda, zeta, work, ifail)
Integer, Intent (In):: m, n, nrowp, lda
Integer, Intent (Inout):: ifail
Real (Kind=nag_wp), Intent (In):: zeta(*)
Real (Kind=nag_wp), Intent (Inout):: a(lda,*)
Real (Kind=nag_wp), Intent (Out):: work(max(m-1,nrowp-m,1))
Character (1), Intent (In):: wheret
C Header Interface
#include nagmk26.h
void  f01qkf_ ( const char *wheret, const Integer *m, const Integer *n, const Integer *nrowp, double a[], const Integer *lda, const double zeta[], double work[], Integer *ifail, const Charlen length_wheret)

3
Description

P is assumed to be given by
P=PmPm-1P1  
where
Pk = I - uk ukT , uk= wk ζk 0 zk ,  
ζk is a scalar, wk is a (k-1) element vector and zk is an (n-m) element vector. wk must be supplied in the kth row of a in elements ak1,,akk-1. zk must be supplied in the kth row of a in elements akm+1,,akn and ζk must be supplied either in akk or in zetak, depending upon the argument wheret.

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:     wheret – Character(1)Input
On entry: indicates where the elements of ζ are to be found.
wheret='I' (In a)
The elements of ζ are in a.
wheret='S' (Separate)
The elements of ζ are separate from a, in zeta.
Constraint: wheret='I' or 'S'.
2:     m – IntegerInput
On entry: m, the number of rows of the matrix A.
Constraint: m0.
3:     n – IntegerInput
On entry: n, the number of columns of the matrix A.
Constraint: nm.
4:     nrowp – IntegerInput
On entry: , the required number of rows of P.
If nrowp=0, an immediate return is effected.
Constraint: 0nrowpn.
5:     alda* – Real (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array a must be at least max1,n.
On entry: the leading m by m strictly lower triangular part of the array a, and the m by n-m rectangular part of a with top left-hand corner at element a1m+1 must contain details of the matrix P. In addition, if wheret='I', the diagonal elements of a must contain the elements of ζ.
On exit: the first nrowp rows of the array a are overwritten by the first nrowp rows of the n by n orthogonal matrix PT.
6:     lda – IntegerInput
On entry: the first dimension of the array a as declared in the (sub)program from which f01qkf is called.
Constraint: ldamax1,m,nrowp.
7:     zeta* – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array zeta must be at least max1,m if wheret='S', and at least 1 otherwise.
On entry: with wheret='S', the array zeta must contain the elements of ζ. If zetak=0.0 then Pk is assumed to be I, otherwise zetak is assumed to contain ζk.
When wheret='I', the array zeta is not referenced.
8:     workmaxm-1,nrowp-m,1 – Real (Kind=nag_wp) arrayWorkspace
Note: the dimension of the array work must be at least maxm-1,nrowp-m,1.
9:     ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1​ or ​1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1​ or ​1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, if you are not familiar with this argument, the recommended value is 0. When the value -1​ or ​1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=-1
On entry,wheret'I' or 'S',
orm<0,
orn<m,
ornrowp<0 or nrowp>n,
orlda<maxm,nrowp.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

The computed matrix P satisfies the relation
P=Q+E,  
where Q is an exactly orthogonal matrix and
Ecε,  
ε is the machine precision (see x02ajf), c is a modest function of n, and . denotes the spectral (two) norm. See also Section 7 in f01qjf.

8
Parallelism and Performance

f01qkf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

The approximate number of floating-point operations is given by
23m3n-m2-m-m-m, if ​m, and ​ 2323n-, if ​<m.  

10
Example

This example obtains the 5 by 5 orthogonal matrix P following the RQ factorization of the 3 by 5 matrix A given by
A= 2.0 2.0 1.6 2.0 1.2 2.5 2.5 -0.4 -0.5 -0.3 2.5 2.5 2.8 0.5 -2.9 .  

10.1
Program Text

Program Text (f01qkfe.f90)

10.2
Program Data

Program Data (f01qkfe.d)

10.3
Program Results

Program Results (f01qkfe.r)

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