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_dopmtr (f08gg)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dopmtr (f08gg) multiplies an arbitrary real matrix C by the real orthogonal matrix Q which was determined by nag_lapack_dsptrd (f08ge) when reducing a real symmetric matrix to tridiagonal form.

Syntax

[ap, c, info] = f08gg(side, uplo, trans, ap, tau, c, 'm', m, 'n', n)
[ap, c, info] = nag_lapack_dopmtr(side, uplo, trans, ap, tau, c, 'm', m, 'n', n)

Description

nag_lapack_dopmtr (f08gg) is intended to be used after a call to nag_lapack_dsptrd (f08ge), which reduces a real symmetric matrix A to symmetric tridiagonal form T by an orthogonal similarity transformation: A=QTQT. nag_lapack_dsptrd (f08ge) represents the orthogonal matrix Q as a product of elementary reflectors.
This function may be used to form one of the matrix products
QC , QTC , CQ ​ or ​ CQT ,  
overwriting the result on C (which may be any real rectangular matrix).
A common application of this function is to transform a matrix Z of eigenvectors of T to the matrix QZ of eigenvectors of A.

References

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 Q or QT is to be applied to C.
side='L'
Q or QT is applied to C from the left.
side='R'
Q or QT is applied to C from the right.
Constraint: side='L' or 'R'.
2:     uplo – string (length ≥ 1)
This must be the same argument uplo as supplied to nag_lapack_dsptrd (f08ge).
Constraint: uplo='U' or 'L'.
3:     trans – string (length ≥ 1)
Indicates whether Q or QT is to be applied to C.
trans='N'
Q is applied to C.
trans='T'
QT is applied to C.
Constraint: trans='N' or 'T'.
4:     ap: – double array
The dimension of the array ap must be at least max1, m × m+1 / 2  if side='L' and at least max1, n × n+1 / 2  if side='R'
Details of the vectors which define the elementary reflectors, as returned by nag_lapack_dsptrd (f08ge).
5:     tau: – double array
The dimension of the array tau must be at least max1,m-1 if side='L' and at least max1,n-1 if side='R'
Further details of the elementary reflectors, as returned by nag_lapack_dsptrd (f08ge).
6:     cldc: – double array
The first dimension of the array c must be at least max1,m.
The second dimension of the array c must be at least max1,n.
The m by n matrix C.

Optional Input Parameters

1:     m int64int32nag_int scalar
Default: the first dimension of the array c.
m, the number of rows of the matrix C; m is also the order of Q if side='L'.
Constraint: m0.
2:     n int64int32nag_int scalar
Default: the second dimension of the array c.
n, the number of columns of the matrix C; n is also the order of Q if side='R'.
Constraint: n0.

Output Parameters

1:     ap: – double array
The dimension of the array ap will be max1, m × m+1 / 2  if side='L' and at least max1, n × n+1 / 2  if side='R'
Is used as internal workspace prior to being restored and hence is unchanged.
2:     cldc: – double array
The first dimension of the array c will be max1,m.
The second dimension of the array c will be max1,n.
c stores QC or QTC or CQ or CQT as specified by side and trans.
3:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: side, 2: uplo, 3: trans, 4: m, 5: n, 6: ap, 7: tau, 8: c, 9: ldc, 10: work, 11: 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 E such that
E2 = Oε C2 ,  
where ε is the machine precision.

Further Comments

The total number of floating-point operations is approximately 2m2n if side='L' and 2mn2 if side='R'.
The complex analogue of this function is nag_lapack_zupmtr (f08gu).

Example

This example computes the two smallest eigenvalues, and the associated eigenvectors, of the matrix A, where
A = 2.07 3.87 4.20 -1.15 3.87 -0.21 1.87 0.63 4.20 1.87 1.15 2.06 -1.15 0.63 2.06 -1.81 ,  
using packed storage. Here A is symmetric and must first be reduced to tridiagonal form T by nag_lapack_dsptrd (f08ge). The program then calls nag_lapack_dstebz (f08jj) to compute the requested eigenvalues and nag_lapack_dstein (f08jk) to compute the associated eigenvectors of T. Finally nag_lapack_dopmtr (f08gg) is called to transform the eigenvectors to those of A.
function f08gg_example


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

% Symmetric matrix A stored in symmetric packed format (Lower)
uplo = 'L';
n = int64(4);
ap = [2.07;     3.87;     4.20;    -1.15;
               -0.21;     1.87;     0.63;
                          1.15;     2.06;
                                   -1.81];

% Reduce A to tridiagonal form
[apf, d, e, tau, info] = f08ge( ...
                                uplo, n, ap);

% Two smallest eigenvalues
range = 'I';
order = 'B';
vl = 0;
vu = 0;
il = int64(1);
iu = int64(2);
abstol = 0;
[m, nsplit, w, iblock, isplit, info] = ...
f08jj( ...
       range, order, vl, vu, il, iu, abstol, d, e);

% Get corresponding eigenvectors of T
[v, ifailv, info] = f08jk( ...
                           d, e, m, w, iblock, isplit);

% Transform Q*V to get eigenvectors of A 
side = 'Left';
trans = 'No transpose';
[~, z, info] = f08gg( ...
                      side, uplo, trans, apf, tau, v);

% Normalize eigenvectors: largest element positive
for j = 1:m
  [~,k] = max(abs(z(:,j)));
  if z(k,j) < 0;
    z(:,j) = -z(:,j);
  end
end                            

% Display results
fprintf(' Eigenvalues numbered 1 to 2 are:\n   ');
fprintf(' %7.4f',w(1:m));
fprintf('\n\n');

[ifail] = x04ca( ...
                 'General', ' ', z, 'Corresponding eigenvectors of A');


f08gg example results

 Eigenvalues numbered 1 to 2 are:
    -5.0034 -1.9987

 Corresponding eigenvectors of A
          1       2
 1   0.5658 -0.2328
 2  -0.3478  0.7994
 3  -0.4740 -0.4087
 4   0.5781  0.3737

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