hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_lapack_zungrq (f08cw)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_lapack_zungrq (f08cw) generates all or part of the complex n by n unitary matrix Q from an RQ factorization computed by nag_lapack_zgerqf (f08cv).


[a, info] = f08cw(a, tau, 'm', m, 'n', n, 'k', k)
[a, info] = nag_lapack_zungrq(a, tau, 'm', m, 'n', n, 'k', k)


nag_lapack_zungrq (f08cw) is intended to be used following a call to nag_lapack_zgerqf (f08cv), which performs an RQ factorization of a complex matrix A and represents the unitary matrix Q as a product of k elementary reflectors of order n.
This function may be used to generate Q explicitly as a square matrix, or to form only its trailing rows.
Usually Q is determined from the RQ factorization of a p by n matrix A with pn. The whole of Q may be computed by:
[a, info] = f08cw(a, tau);
(note that the matrix A must have at least n rows), or its trailing p rows as:
[a, info] = f08cw(a(1:p,:), tau, 'k', p);
The rows of Q returned by the last call form an orthonormal basis for the space spanned by the rows of A; thus nag_lapack_zgerqf (f08cv) followed by nag_lapack_zungrq (f08cw) can be used to orthogonalize the rows of A.
The information returned by nag_lapack_zgerqf (f08cv) also yields the RQ factorization of the trailing k rows of A, where k<p. The unitary matrix arising from this factorization can be computed by:
[a, info] = f08cw(a, tau, 'k', k);
or its leading k columns by:
[a, info] = f08cw(a(1:k,:), tau, 'k', k);


Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore


Compulsory Input Parameters

1:     alda: – complex array
The first dimension of the array a must be at least max1,m.
The second dimension of the array a must be at least max1,n.
Details of the vectors which define the elementary reflectors, as returned by nag_lapack_zgerqf (f08cv).
2:     tau: – complex array
The dimension of the array tau must be at least max1,k
taui must contain the scalar factor of the elementary reflector Hi, as returned by nag_lapack_zgerqf (f08cv).

Optional Input Parameters

1:     m int64int32nag_int scalar
Default: the first dimension of the array a.
m, the number of rows of the matrix Q.
Constraint: m0.
2:     n int64int32nag_int scalar
Default: the second dimension of the array a.
n, the number of columns of the matrix Q.
Constraint: nm.
3:     k int64int32nag_int scalar
Default: the dimension of the array tau.
k, the number of elementary reflectors whose product defines the matrix Q.
Constraint: mk0.

Output Parameters

1:     alda: – complex array
The first dimension of the array a will be max1,m.
The second dimension of the array a will be max1,n.
The m by n matrix Q.
2:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: m, 2: n, 3: k, 4: a, 5: lda, 6: tau, 7: work, 8: lwork, 9: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.


The computed matrix Q differs from an exactly unitary matrix by a matrix E such that
E2 = Oε  
and ε is the machine precision.

Further Comments

The total number of floating-point operations is approximately 16mnk-8m+nk2+163k3; when m=k this becomes 83m23n-m.
The real analogue of this function is nag_lapack_dorgrq (f08cj).


This example generates the first four rows of the matrix Q of the RQ factorization of A as returned by nag_lapack_zgerqf (f08cv), where
A = 0.96-0.81i -0.98+1.98i 0.62-0.46i -0.37+0.38i 0.83+0.51i 1.08-0.28i -0.03+0.96i -1.20+0.19i 1.01+0.02i 0.19-0.54i 0.20+0.01i 0.20-0.12i -0.91+2.06i -0.66+0.42i 0.63-0.17i -0.98-0.36i -0.17-0.46i -0.07+1.23i -0.05+0.41i -0.81+0.56i -1.11+0.60i 0.22-0.20i 1.47+1.59i 0.26+0.26i .  
Note that the block size (NB) of 64 assumed in this example is not realistic for such a small problem, but should be suitable for large problems.
function f08cw_example

fprintf('f08cw example results\n\n');

% Form Q from RQ factorization of A
a = [ 0.96 - 0.81i, -0.03 + 0.96i,  -0.91 + 2.06i, -0.05 + 0.41i;
     -0.98 + 1.98i, -1.20 + 0.19i,  -0.66 + 0.42i, -0.81 + 0.56i;
      0.62 - 0.46i,  1.01 + 0.02i,   0.63 - 0.17i, -1.11 + 0.60i;
     -0.37 + 0.38i,  0.19 - 0.54i,  -0.98 - 0.36i,  0.22 - 0.20i;
      0.83 + 0.51i,  0.20 + 0.01i,  -0.17 - 0.46i,  1.47 + 1.59i;
      1.08 - 0.28i,  0.20 - 0.12i,  -0.07 + 1.23i,  0.26 + 0.26i];
a = transpose(a);
[m,n] = size(a);

% Compute the RQ factorization of A
[rq, tau, info] = f08cv(a);

% Form Q
[Q, info] = f08cw(rq, tau);

%Print Q
ncols  = int64(80);
indent = int64(0);
[ifail] = x04db( ...
		 'General', ' ', Q, 'Bracketed', 'F7.4', ...
		 'Unitary Q from RQ of A', 'Integer', 'Integer', ...
		 ncols, indent);

f08cw example results

 Unitary Q from RQ of A
                    1                 2                 3                 4
 1  ( 0.2810, 0.5020) ( 0.2707,-0.3296) (-0.2864,-0.0094) ( 0.2262,-0.3854)
 2  (-0.2051,-0.1092) ( 0.5711, 0.0432) (-0.5416, 0.0454) (-0.3387, 0.2228)
 3  ( 0.3083,-0.6874) ( 0.2251,-0.1313) (-0.2062, 0.0691) ( 0.3259, 0.1178)
 4  ( 0.0181,-0.1483) ( 0.2930,-0.2025) ( 0.4015,-0.2170) (-0.0796, 0.0723)

                    5                 6
 1  ( 0.0341,-0.0760) (-0.3936,-0.2083)
 2  ( 0.0098,-0.0712) (-0.1296, 0.3691)
 3  ( 0.0753, 0.1412) ( 0.0264,-0.4134)
 4  (-0.5317,-0.5751) (-0.0940,-0.0940)

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015