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_matop_complex_gen_rq_formq (f01rk)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_matop_complex_gen_rq_formq (f01rk) returns the first  rows of the n by n unitary matrix PH, where P is given as the product of Householder transformation matrices.
This function is intended for use following nag_matop_complex_gen_rq (f01rj).

Syntax

[a, ifail] = f01rk(wheret, m, nrowp, a, theta, 'n', n)
[a, ifail] = nag_matop_complex_gen_rq_formq(wheret, m, nrowp, a, theta, 'n', n)

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 ak1,,akk-1. zk must be supplied in the kth row of a in elements akm+1,,akn and θk, given by
θk=ζk,Imγk,  
must be supplied either in akk or in thetak, depending upon the argument wheret.

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

Parameters

Compulsory Input Parameters

1:     wheret – string (length ≥ 1)
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 int64int32nag_int scalar
m, the number of rows of the matrix A.
Constraint: m0.
3:     nrowp int64int32nag_int scalar
, the required number of rows of P.
If nrowp=0, an immediate return is effected.
Constraint: 0nrowpn.
4:     alda: – complex array
The first dimension of the array a must be at least max1,m,nrowp.
The second dimension of the array a must be at least max1,n.
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 θ.
5:     theta: – complex array
The dimension of the array theta must be at least max1,m if wheret='S', and at least 1 otherwise
If wheret='S', the array theta must contain the elements of θ. If thetak=0.0, Pk is assumed to be I, if thetak=α and Reα<0.0, Pk is assumed to be of the form
Pk= I 0 0 0 α 0 0 0 I ,  
otherwise thetak is assumed to contain θk given by
θk=ζk,Imγk.  
If wheret='I', the array theta is not referenced.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the second dimension of the array a.
n, the number of columns of the matrix A.
Constraint: nm.

Output Parameters

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

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=-1
On entry,wheret'I' or 'S',
orm<0,
orn<m,
ornrowp<0 or nrowp>n,
orlda<max1,m,nrowp.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

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 nag_machine_precision (x02aj)), c is a modest function of n, and . denotes the spectral (two) norm. See also Accuracy in nag_matop_complex_gen_rq (f01rj).

Further Comments

The approximate number of floating-point operations is given by
83n3n-m2-m-m-m, if ​m, and ​ 8323n-, if ​<m.  

Example

This example obtains the 5 by 5 unitary matrix P following the RQ factorization of the 3 by 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 .  
function f01rk_example


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

a = [  0   - 0.5i,  0.4 - 0.3i,  0.4 + 0i,    0.3 + 0.4i,  0   + 0.3i;
      -0.5 - 1.5i,  0.9 - 1.3i, -0.4 - 0.4i,  0.1 - 0.7i,  0.3 - 0.3i;
      -1   - i,     0.2 - 1.4i,  1.8 + 0i,    0   + 0i,    0   - 2.4i];

[RQ, theta, ifail] = f01rj(a);

wheret = 'Separate';
m     = int64(size(a,1));
nrowp = int64(size(a,2));
RQ(m+1:nrowp,1:nrowp) = complex(0);

[PT, ifail] = f01rk( ...
                     wheret, m, nrowp, RQ, theta);

P = PT';
disp('Matrix P');
disp(P);


f01rk example results

Matrix P
  -0.1970 + 0.1970i   0.1639 - 0.4916i   0.2774 - 0.2774i   0.3637 + 0.3213i   0.0123 + 0.5142i
   0.0394 + 0.2757i  -0.2950 - 0.4261i  -0.0555 - 0.3883i  -0.4752 + 0.0982i  -0.4187 - 0.2987i
   0.3151 - 0.1576i   0.4516 - 0.3205i  -0.4992 + 0.0000i  -0.2762 - 0.3049i  -0.0339 + 0.3867i
   0.1970 - 0.5909i  -0.0473 - 0.3314i   0.0000 + 0.0000i   0.5121 - 0.0475i  -0.3613 - 0.3239i
  -0.1182 - 0.5646i   0.0328 + 0.2076i   0.0000 - 0.6656i  -0.2287 + 0.2072i   0.2901 + 0.0254i


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