NAG FL Interface
f01rjf (complex_​gen_​rq)

1 Purpose

f01rjf finds the RQ factorization of the complex m by n (mn), matrix A, so that A is reduced to upper triangular form by means of unitary transformations from the right.

2 Specification

Fortran Interface
Subroutine f01rjf ( m, n, a, lda, theta, ifail)
Integer, Intent (In) :: m, n, lda
Integer, Intent (Inout) :: ifail
Complex (Kind=nag_wp), Intent (Inout) :: a(lda,*)
Complex (Kind=nag_wp), Intent (Out) :: theta(m)
C Header Interface
#include <nag.h>
void  f01rjf_ (const Integer *m, const Integer *n, Complex a[], const Integer *lda, Complex theta[], Integer *ifail)
The routine may be called by the names f01rjf or nagf_matop_complex_gen_rq.

3 Description

The m by n matrix A is factorized as
A= R 0 PH when ​m<n, A=RPH when ​m=n,  
where P is an n by n unitary matrix and R is an m by m upper triangular matrix.
P is given as a sequence of Householder transformation matrices
P=PmP2P1,  
the m-k+1th transformation matrix, Pk, being used to introduce zeros into the kth row of A. Pk has the form
Pk=I-γkukukH,  
where
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. γk and uk are chosen to annihilate the elements in the kth row of A.
The scalar γk and the vector uk are returned in the kth element of theta and in the kth row of a, such that θk, given by
θk=ζk,Imγk.  
is in thetak, the elements of wk are in ak1,,akk-1 and the elements of zk are in akm+1,,akn. The elements of R are returned in the upper triangular part of a.

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: m Integer Input
On entry: m, the number of rows of the matrix A.
When m=0 then an immediate return is effected.
Constraint: m0.
2: n Integer Input
On entry: n, the number of columns of the matrix A.
Constraint: nm.
3: alda* Complex (Kind=nag_wp) array Input/Output
Note: the second dimension of the array a must be at least max1,n.
On entry: the leading m by n part of the array a must contain the matrix to be factorized.
On exit: the m by m upper triangular part of a will contain the upper triangular matrix R, and the m by m strictly lower triangular part of a and the m by n-m rectangular part of a to the right of the upper triangular part will contain details of the factorization as described in Section 3.
4: lda Integer Input
On entry: the first dimension of the array a as declared in the (sub)program from which f01rjf is called.
Constraint: ldamax1,m.
5: thetam Complex (Kind=nag_wp) array Output
On exit: thetak contains the scalar θk for the m-k+1th transformation. If Pk=I then thetak=0.0; if
Tk= I 0 0 0 α 0 0 0 I ,  Reα<0.0  
then thetak=α, otherwise thetak contains θk as described in Section 3 and θk is always in the range 1.0,2.0.
6: 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 and m=value.
Constraint: ldam.
On entry, m=value.
Constraint: m0.
On entry, n=value and m=value.
Constraint: nm.
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 factors R and P satisfy the relation
R0PH=A+E,  
where
Ecε A,  
ε is the machine precision (see x02ajf), c is a modest function of m and n, and . denotes the spectral (two) norm.

8 Parallelism and Performance

f01rjf 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 8×m23n-m/3.
The first k rows of the unitary matrix PH can be obtained by calling f01rkf, which overwrites the k rows of PH on the first k rows of the array a. PH is obtained by the call:
ifail = 0
Call f01rkf('Separate',m,n,k,a,lda,theta,work,ifail)
WORK must be a maxm-1,k-m,1 element array. If K is larger than M, then a must have been declared to have at least K rows.
Operations involving the matrix R can readily be performed by the Level 2 BLAS routines f06sff and f06sjf, (see Chapter F06), but note that no test for near singularity of R is incorporated into f06sff. If R is singular, or nearly singular then f02xuf can be used to determine the singular value decomposition of R.

10 Example

This example obtains the RQ factorization of the 3 by 5 matrix
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 (f01rjfe.f90)

10.2 Program Data

Program Data (f01rjfe.d)

10.3 Program Results

Program Results (f01rjfe.r)