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_dorcsd (f08ra)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dorcsd (f08ra) computes the CS decomposition of a real m by m orthogonal matrix X, partitioned into a 2 by 2 array of submatrices.

Syntax

[x11, x12, x21, x22, theta, u1, u2, v1t, v2t, info] = f08ra(m, p, q, x11, x12, x21, x22, 'jobu1', jobu1, 'jobu2', jobu2, 'jobv1t', jobv1t, 'jobv2t', jobv2t, 'trans', trans, 'signs', signs)
[x11, x12, x21, x22, theta, u1, u2, v1t, v2t, info] = nag_lapack_dorcsd(m, p, q, x11, x12, x21, x22, 'jobu1', jobu1, 'jobu2', jobu2, 'jobv1t', jobv1t, 'jobv2t', jobv2t, 'trans', trans, 'signs', signs)

Description

The m by m orthogonal matrix X is partitioned as
X= X11 X12 X21 X22  
where X11 is a p by q submatrix and the dimensions of the other submatrices X12, X21 and X22 are such that X remains m by m.
The CS decomposition of X is X= UΣpVT  where U, V and Σp are m by m matrices, such that
U= U1 0 0 U2  
is an orthogonal matrix containing the p by p orthogonal matrix U1 and the m-p by m-p orthogonal matrix U2;
V= V1 0 0 V2  
is an orthogonal matrix containing the q by q orthogonal matrix V1 and the m-q by m-q orthogonal matrix V2; and
Σp= I11 0 0 0 C 0 0 -S 0 0 0 -I12 0 0 I22 0 0 S C 0 0 I21 0 0  
contains the r by r non-negative diagonal submatrices C and S satisfying C2+S2=I, where r=minp,m-p,q,m-q and the top left partition is p by q.
The identity matrix I11 is of order minp,q-r and vanishes if minp,q=r.
The identity matrix I12 is of order minp,m-q-r and vanishes if minp,m-q=r.
The identity matrix I21 is of order minm-p,q-r and vanishes if minm-p,q=r.
The identity matrix I22 is of order minm-p,m-q-r and vanishes if minm-p,m-q=r.
In each of the four cases r=p,q,m-p,m-q at least two of the identity matrices vanish.
The indicated zeros represent augmentations by additional rows or columns (but not both) to the square diagonal matrices formed by Iij and C or S.
Σp does not need to be stored in full; it is sufficient to return only the values θi for i=1,2,,r where Cii=cosθi and Sii=sinθi.
The algorithm used to perform the complete CS decomposition is described fully in Sutton (2009) including discussions of the stability and accuracy of the algorithm.

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 (2012) Matrix Computations (4th Edition) Johns Hopkins University Press, Baltimore
Sutton B D (2009) Computing the complete CS decomposition Numerical Algorithms (Volume 50) 1017–1398 Springer US 33–65 http://dx.doi.org/10.1007/s11075-008-9215-6

Parameters

Compulsory Input Parameters

1:     m int64int32nag_int scalar
m, the number of rows and columns in the orthogonal matrix X.
Constraint: m0.
2:     p int64int32nag_int scalar
p, the number of rows in X11 and X12.
Constraint: 0pm.
3:     q int64int32nag_int scalar
q, the number of columns in X11 and X21.
Constraint: 0qm.
4:     x11ldx11: – double array
The first dimension, ldx11, of the array x11 must satisfy
  • if trans='T', ldx11max1,q;
  • otherwise ldx11max1,p.
The second dimension of the array x11 must be at least max1,p if trans='T', and at least q otherwise.
The upper left partition of the orthogonal matrix X whose CSD is desired.
5:     x12ldx12: – double array
The first dimension, ldx12, of the array x12 must satisfy
  • if trans='T', ldx12max1,m-q;
  • otherwise ldx12max1,p.
The second dimension of the array x12 must be at least max1,p if trans='T', and at least m-q otherwise.
The upper right partition of the orthogonal matrix X whose CSD is desired.
6:     x21ldx21: – double array
The first dimension, ldx21, of the array x21 must satisfy
  • if trans='T', ldx21max1,q;
  • otherwise ldx21max1,m-p.
The second dimension of the array x21 must be at least max1,m-p if trans='T', and at least q otherwise.
The lower left partition of the orthogonal matrix X whose CSD is desired.
7:     x22ldx22: – double array
The first dimension, ldx22, of the array x22 must satisfy
  • if trans='T', ldx22max1,m-q;
  • otherwise ldx22max1,m-p.
The second dimension of the array x22 must be at least max1,m-p if trans='T', and at least m-q otherwise.
The lower right partition of the orthogonal matrix X CSD is desired.

Optional Input Parameters

1:     jobu1 – string (length ≥ 1)
Default: 'Y'
  • if jobu1='Y', U1 is computed;
  • otherwise, U1 is not computed.
2:     jobu2 – string (length ≥ 1)
Default: 'Y'
  • if jobu2='Y', U2 is computed;
  • otherwise, U2 is not computed.
3:     jobv1t – string (length ≥ 1)
Default: 'Y'
  • if jobv1t='Y', V1T is computed;
  • otherwise, V1T is not computed.
4:     jobv2t – string (length ≥ 1)
Default: 'Y'
  • if jobv2t='Y', V2T is computed;
  • otherwise, V2T is not computed.
5:     trans – string (length ≥ 1)
Default: 'N'
  • if trans='T', X, U1, U2, V1T and V2T are stored in row-major order;
  • otherwise, X, U1, U2, V1T and V2T are stored in column-major order.
6:     signs – string (length ≥ 1)
Default: 'D'
  • if signs='O', the lower-left block is made nonpositive (the other convention);
  • otherwise, the upper-right block is made nonpositive (the default convention).

Output Parameters

1:     x11ldx11: – double array
The first dimension, ldx11, of the array x11 will be
  • if trans='T', ldx11=max1,q;
  • otherwise ldx11=max1,p.
The second dimension of the array x11 will be max1,p if trans='T' and q otherwise.
Contains details of the orthogonal matrix used in a simultaneous bidiagonalization process.
2:     x12ldx12: – double array
The first dimension, ldx12, of the array x12 will be
  • if trans='T', ldx12=max1,m-q;
  • otherwise ldx12=max1,p.
The second dimension of the array x12 will be max1,p if trans='T' and m-q otherwise.
Contains details of the orthogonal matrix used in a simultaneous bidiagonalization process.
3:     x21ldx21: – double array
The first dimension, ldx21, of the array x21 will be
  • if trans='T', ldx21=max1,q;
  • otherwise ldx21=max1,m-p.
The second dimension of the array x21 will be max1,m-p if trans='T' and q otherwise.
Contains details of the orthogonal matrix used in a simultaneous bidiagonalization process.
4:     x22ldx22: – double array
The first dimension, ldx22, of the array x22 will be
  • if trans='T', ldx22=max1,m-q;
  • otherwise ldx22=max1,m-p.
The second dimension of the array x22 will be max1,m-p if trans='T' and m-q otherwise.
Contains details of the orthogonal matrix used in a simultaneous bidiagonalization process.
5:     thetaminp,m-p,q,m-q – double array
The values θi for i=1,2,,r where r=minp,m-p,q,m-q. The diagonal submatrices C and S of Σp are constructed from these values as
  • C= diagcos theta1 ,,cos thetar and
  • S= diagsin theta1 ,,sin thetar .
6:     u1ldu1: – double array
The first dimension of the array u1 will be if jobu1='Y', ldu1=max1,p.
The second dimension of the array u1 will be max1,p if jobu1='Y' and 1 otherwise.
If jobu1='Y', u1 contains the p by p orthogonal matrix U1.
7:     u2ldu2: – double array
The first dimension of the array u2 will be if jobu2='Y', ldu2=max1,m-p.
The second dimension of the array u2 will be max1,m-p if jobu2='Y' and 1 otherwise.
If jobu2='Y', u2 contains the m-p by m-p orthogonal matrix U2.
8:     v1tldv1t: – double array
The first dimension of the array v1t will be if jobv1t='Y', ldv1t=max1,q.
The second dimension of the array v1t will be max1,q if jobv1t='Y' and 1 otherwise.
If jobv1t='Y', v1t contains the q by q orthogonal matrix V1T.
9:     v2tldv2t: – double array
The first dimension of the array v2t will be if jobv2t='Y', ldv2t=max1,m-q.
The second dimension of the array v2t will be max1,m-q if jobv2t='Y' and 1 otherwise.
If jobv2t='Y', v2t contains the m-q by m-q orthogonal matrix V2T.
10:   info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info<0
If info=-i, argument i had an illegal value. An explanatory message is output, and execution of the program is terminated.
   info>0
The Jacobi-type procedure failed to converge during an internal reduction to bidiagonal-block form. The process requires convergence to minp,m-p,q,m-q values, the value of info gives the number of converged values.

Accuracy

The computed CS decomposition is nearly the exact CS decomposition for the nearby matrix X+E , where
E2 = Oε ,  
and ε  is the machine precision.

Further Comments

The total number of floating-point operations required to perform the full CS decomposition is approximately 2m3.
The complex analogue of this function is nag_lapack_zuncsd (f08rn).

Example

This example finds the full CS decomposition of
X = -0.13484 0.52524 -0.20924 0.81373 0.67420 -0.52213 -0.38886 0.34874 0.26968 0.52757 -0.65782 -0.46499 0.67420 0.41615 0.61014 0.00000  
partitioned in 2 by 2 blocks.
The decomposition is performed both on submatrices of the orthogonal matrix X and on separated partition matrices. Code is also provided to perform a recombining check if required.
function f08ra_example


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

% Find the full CS decomposition of X:
m = int64(5);
p = int64(3);
q = int64(2);
x = [-0.7576  0.3697  0.3838  0.2126 -0.3112;
     -0.4077 -0.1552 -0.1129  0.2676  0.8517;
     -0.0488  0.7240 -0.6730 -0.1301  0.0602;
     -0.2287  0.0088  0.2235 -0.9235  0.2120;
      0.4530  0.5612  0.5806  0.1162  0.3595];

% Partition matrix
x11 = x(1:p,  1:q);   x12 = x(1:p,  q+1:m);
x21 = x(p+1:m,1:q);   x22 = x(p+1:m,q+1:m);

[x11, x12, x21, x22, theta, u1, u2, v1t, v2t, info] = ...
f08ra( ...
       m, p, q, x11, x12, x21, x22);

disp('Components of CS factorization of X:');
disp('    Theta');
disp(theta);
disp('    U1');
disp(u1);
disp('    U2');
disp(u2);
disp('    V1');
disp(v1t');
disp('    V2');
disp(v2t');


f08ra example results

Components of CS factorization of X:
    Theta
    0.1811
    0.8255

    U1
   -0.8249   -0.3370   -0.4538
   -0.2042   -0.5710    0.7952
   -0.5271    0.7486    0.4022

    U2
   -0.9802   -0.1982
   -0.1982    0.9802

    V1
    0.7461    0.6658
   -0.6658    0.7461

    V2
   -0.3397    0.7738    0.5346
    0.8967    0.4379   -0.0640
   -0.2837    0.4576   -0.8427


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