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_zunmrq (f08cx)

Purpose

nag_lapack_zunmrq (f08cx) multiplies a general complex mm by nn matrix CC by the complex unitary matrix QQ from an RQRQ factorization computed by nag_lapack_zgerqf (f08cv).

Syntax

[a, c, info] = f08cx(side, trans, a, tau, c, 'm', m, 'n', n, 'k', k)
[a, c, info] = nag_lapack_zunmrq(side, trans, a, tau, c, 'm', m, 'n', n, 'k', k)

Description

nag_lapack_zunmrq (f08cx) is intended to be used following a call to nag_lapack_zgerqf (f08cv), which performs an RQRQ factorization of a complex matrix AA and represents the unitary matrix QQ as a product of elementary reflectors.
This function may be used to form one of the matrix products
QC ,   QHC ,   CQ ,   CQH ,
QC ,   QHC ,   CQ ,   CQH ,
overwriting the result on CC, which may be any complex rectangular mm by nn matrix.
A common application of this function is in solving underdetermined linear least squares problems, as described in the F08 Chapter Introduction, and illustrated in Section [Example] in (f08cv).

References

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

Parameters

Compulsory Input Parameters

1:     side – string (length ≥ 1)
Indicates how QQ or QHQH is to be applied to CC.
side = 'L'side='L'
QQ or QHQH is applied to CC from the left.
side = 'R'side='R'
QQ or QHQH is applied to CC from the right.
Constraint: side = 'L'side='L' or 'R''R'.
2:     trans – string (length ≥ 1)
Indicates whether QQ or QHQH is to be applied to CC.
trans = 'N'trans='N'
QQ is applied to CC.
trans = 'C'trans='C'
QHQH is applied to CC.
Constraint: trans = 'N'trans='N' or 'C''C'.
3:     a(lda, : :) – complex array
The first dimension of the array a must be at least max (1,k)max(1,k)
The second dimension of the array must be at least max (1,m)max(1,m) if side = 'L'side='L' and at least max (1,n)max(1,n) if side = 'R'side='R'
The iith row of a must contain the vector which defines the elementary reflector HiHi, for i = 1,2,,ki=1,2,,k, as returned by nag_lapack_zgerqf (f08cv).
4:     tau( : :) – complex array
Note: the dimension of the array tau must be at least max (1,k)max(1,k).
tau(i)taui must contain the scalar factor of the elementary reflector HiHi, as returned by nag_lapack_zgerqf (f08cv).
5:     c(ldc, : :) – complex array
The first dimension of the array c must be at least max (1,m)max(1,m)
The second dimension of the array must be at least max (1,n)max(1,n)
The mm by nn matrix CC.

Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The first dimension of the array c.
mm, the number of rows of the matrix CC.
Constraint: m0m0.
2:     n – int64int32nag_int scalar
Default: The second dimension of the array c.
nn, the number of columns of the matrix CC.
Constraint: n0n0.
3:     k – int64int32nag_int scalar
Default: The first dimension of the array a The dimension of the array tau.
kk, the number of elementary reflectors whose product defines the matrix QQ.
Constraints:
  • if side = 'L'side='L', m k 0 m k 0 ;
  • if side = 'R'side='R', n k 0 n k 0 .

Input Parameters Omitted from the MATLAB Interface

lda ldc work lwork

Output Parameters

1:     a(lda, : :) – complex array
The first dimension of the array a will be max (1,k)max(1,k)
The second dimension of the array will be max (1,m)max(1,m) if side = 'L'side='L' and at least max (1,n)max(1,n) if side = 'R'side='R'
ldamax (1,k)ldamax(1,k).
Is modified by nag_lapack_zunmrq (f08cx) but restored on exit.
2:     c(ldc, : :) – complex array
The first dimension of the array c will be max (1,m)max(1,m)
The second dimension of the array will be max (1,n)max(1,n)
ldcmax (1,m)ldcmax(1,m).
c stores QCQC or QHCQHC or CQCQ or CQHCQH as specified by side and trans.
3:     info – int64int32nag_int scalar
info = 0info=0 unless the function detects an error (see Section [Error Indicators and Warnings]).

Error Indicators and Warnings

  info = iinfo=-i
If info = iinfo=-i, parameter ii had an illegal value on entry. The parameters are numbered as follows:
1: side, 2: trans, 3: m, 4: n, 5: k, 6: a, 7: lda, 8: tau, 9: c, 10: ldc, 11: work, 12: lwork, 13: 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.

Accuracy

The computed result differs from the exact result by a matrix EE such that
E2 = Oε C2
E2 = Oε C2
where εε is the machine precision.

Further Comments

The total number of floating point operations is approximately 8nk(2mk)8nk(2m-k) if side = 'L'side='L' and 8mk(2nk)8mk(2n-k) if side = 'R'side='R'.
The real analogue of this function is nag_lapack_dormrq (f08ck).

Example

function nag_lapack_zunmrq_example
a = [ 0.28 - 0.36i,  0.5 - 0.86i,  -0.77 - 0.48i, ...
      1.58 + 0.66i;
      -0.5 - 1.1i,  -1.21 + 0.76i,  -0.32 - 0.24i, ...
      -0.27 - 1.15i;
      0.36 - 0.51i,  -0.07 + 1.33i,  -0.75 + 0.47i, ...
      -0.08 + 1.01i];
b = [ -1.35 + 0.19i;
      9.41 - 3.56i;
      -7.57 + 6.93i];
% Compute the RQ factorization of a
[a, tau, info] = nag_lapack_zgerqf(a);

% Solve R*y2 = b
c = zeros(4, 1);
[c(2:4,:), info] = nag_lapack_ztrtrs('Upper', 'No transpose','Non-Unit', a(:,2:4), b);

if (info > 0)
  fprintf('The upper triangular factor, R, of A is singular,\n');
  fprintf('the least squares solution could not be computed.\n');
else
  % Compute the minimum-norm solution x = (Q^H)*y
  [a, c, info] = nag_lapack_zunmrq('Left', 'Conjugate Transpose', a, tau, c);

  fprintf('\nMinimum-norm solution\n');
  disp(transpose(c));
end
 

Minimum-norm solution
  -2.8501 + 6.4683i   1.6264 - 0.7799i   6.9290 + 4.6481i   1.4048 + 3.2400i


function f08cx_example
a = [ 0.28 - 0.36i,  0.5 - 0.86i,  -0.77 - 0.48i, ...
      1.58 + 0.66i;
      -0.5 - 1.1i,  -1.21 + 0.76i,  -0.32 - 0.24i, ...
      -0.27 - 1.15i;
      0.36 - 0.51i,  -0.07 + 1.33i,  -0.75 + 0.47i, ...
      -0.08 + 1.01i];
b = [ -1.35 + 0.19i;
      9.41 - 3.56i;
      -7.57 + 6.93i];
% Compute the RQ factorization of a
[a, tau, info] = f08cv(a);

% Solve R*y2 = b
c = zeros(4, 1);
[c(2:4,:), info] = f07ts('Upper', 'No transpose','Non-Unit', a(:,2:4), b);

if (info > 0)
  fprintf('The upper triangular factor, R, of A is singular,\n');
  fprintf('the least squares solution could not be computed.\n');
else
  % Compute the minimum-norm solution x = (Q^H)*y
  [a, c, info] = f08cx('Left', 'Conjugate Transpose', a, tau, c);

  fprintf('\nMinimum-norm solution\n');
  disp(transpose(c));
end
 

Minimum-norm solution
  -2.8501 + 6.4683i   1.6264 - 0.7799i   6.9290 + 4.6481i   1.4048 + 3.2400i



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–2013