NAG FL Interface
f01rkf (complex_​gen_​rq_​formq)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

f01rkf returns the first rows of the n×n unitary matrix PH, where P is given as the product of Householder transformation matrices.
This routine is intended for use following f01rjf.

2 Specification

Fortran Interface
Subroutine f01rkf ( wheret, m, n, nrowp, a, lda, theta, work, ifail)
Integer, Intent (In) :: m, n, nrowp, lda
Integer, Intent (Inout) :: ifail
Complex (Kind=nag_wp), Intent (In) :: theta(*)
Complex (Kind=nag_wp), Intent (Inout) :: a(lda,*)
Complex (Kind=nag_wp), Intent (Out) :: work(max(m-1,nrowp-m,1))
Character (1), Intent (In) :: wheret
C Header Interface
#include <nag.h>
void  f01rkf_ (const char *wheret, const Integer *m, const Integer *n, const Integer *nrowp, Complex a[], const Integer *lda, const Complex theta[], Complex work[], Integer *ifail, const Charlen length_wheret)
The routine may be called by the names f01rkf or nagf_matop_complex_gen_rq_formq.

3 Description

P is assumed to be given by
P = Pm P m-1 P1 ,  
where
Pk=I-γkukukH, uk=( wk ζk 0 zk )  
γk is a scalar for which Re(γk)=1.0, ζk is a real 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 a(k,1),,a(k,k-1). zk must be supplied in the kth row of a in elements a(k,m+1),,a(k,n) and θk, given by
θk=(ζk,Im(γk)),  
must be supplied either in a(k,k) or in theta(k), 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 theta.
Constraint: wheret='I' or 'S'.
2: m Integer Input
On entry: m, the number of rows of the matrix A.
Constraint: m0.
3: n Integer Input
On entry: n, the number of columns of the matrix A.
Constraint: nm.
4: nrowp Integer Input
On entry: , the required number of rows of P.
If nrowp=0, an immediate return is effected.
Constraint: 0nrowpn.
5: a(lda,*) Complex (Kind=nag_wp) array Input/Output
Note: the second dimension of the array a must be at least max(1,n).
On entry: the leading m×m strictly lower triangular part of the array a, and the m×(n-m) rectangular part of a with top left-hand corner at element a(1,m+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×n unitary matrix PH.
6: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f01rkf is called.
Constraint: ldamax(1,m,nrowp).
7: theta(*) Complex (Kind=nag_wp) array Input
Note: the dimension of the array theta must be at least max(1,m) if wheret='S', and at least 1 otherwise.
On entry: if wheret='S', the array theta must contain the elements of θ. If theta(k)=0.0, Pk is assumed to be I, if theta(k)=α and Re(α)<0.0, Pk is assumed to be of the form
Pk=( I 0 0 0 α 0 0 0 I ),  
otherwise theta(k) is assumed to contain θk given by
θk=(ζk,Im(γk)).  
If wheret='I', the array theta is not referenced.
8: work(max(m-1,nrowp-m,1)) Complex (Kind=nag_wp) array Workspace
9: ifail Integer Input/Output
On entry: ifail must be set to 0, -1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of -1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value -1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. 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, lda=value, m=value and nrowp=value.
Constraint: ldamax(m,nrowp).
On entry, m=value.
Constraint: m0.
On entry, n=value and m=value.
Constraint: nm.
On entry, nrowp=value and n=value.
Constraint: nrowp0 and nrowpn.
On entry, wheret=value.
Constraint: wheret='I' or 'S'.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

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

8 Parallelism and Performance

f01rkf 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
83n[(3n-m)(2-m)-m(-m)], if ​m, and ​ 832(3n-), if ​<m.  

10 Example

This example obtains the 5×5 unitary matrix P following the RQ factorization of the 3×5 matrix A given by
A = ( -0.5i 0.4-0.3i 0.4i+0.0 0.3-0.4i 0.3i -0.5-1.5i 0.9-1.3i -0.4-0.4i 0.1-0.7i 0.3-0.3i -1.0-1.0i 0.2-1.4i 1.8i+0.0 0.0i+0.0 -2.4i ) .  

10.1 Program Text

Program Text (f01rkfe.f90)

10.2 Program Data

Program Data (f01rkfe.d)

10.3 Program Results

Program Results (f01rkfe.r)