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_dgebak (f08nj)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dgebak (f08nj) transforms eigenvectors of a balanced matrix to those of the original real nonsymmetric matrix.

Syntax

[v, info] = f08nj(job, side, ilo, ihi, scale, v, 'n', n, 'm', m)
[v, info] = nag_lapack_dgebak(job, side, ilo, ihi, scale, v, 'n', n, 'm', m)

Description

nag_lapack_dgebak (f08nj) is intended to be used after a real nonsymmetric matrix A has been balanced by nag_lapack_dgebal (f08nh), and eigenvectors of the balanced matrix A22 have subsequently been computed.
For a description of balancing, see the document for nag_lapack_dgebal (f08nh). The balanced matrix A is obtained as A=DPAPTD-1, where P is a permutation matrix and D is a diagonal scaling matrix. This function transforms left or right eigenvectors as follows:

References

None.

Parameters

Compulsory Input Parameters

1:     job – string (length ≥ 1)
This must be the same argument job as supplied to nag_lapack_dgebal (f08nh).
Constraint: job='N', 'P', 'S' or 'B'.
2:     side – string (length ≥ 1)
Indicates whether left or right eigenvectors are to be transformed.
side='L'
The left eigenvectors are transformed.
side='R'
The right eigenvectors are transformed.
Constraint: side='L' or 'R'.
3:     ilo int64int32nag_int scalar
4:     ihi int64int32nag_int scalar
The values ilo and ihi, as returned by nag_lapack_dgebal (f08nh).
Constraints:
  • if n>0, 1 ilo ihi n ;
  • if n=0, ilo=1 and ihi=0.
5:     scale: – double array
The dimension of the array scale must be at least max1,n
Details of the permutations and/or the scaling factors used to balance the original real nonsymmetric matrix, as returned by nag_lapack_dgebal (f08nh).
6:     vldv: – double array
The first dimension of the array v must be at least max1,n.
The second dimension of the array v must be at least max1,m.
The matrix of left or right eigenvectors to be transformed.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array v.
n, the number of rows of the matrix of eigenvectors.
Constraint: n0.
2:     m int64int32nag_int scalar
Default: the second dimension of the array v.
m, the number of columns of the matrix of eigenvectors.
Constraint: m0.

Output Parameters

1:     vldv: – double array
The first dimension of the array v will be max1,n.
The second dimension of the array v will be max1,m.
The transformed eigenvectors.
2:     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: job, 2: side, 3: n, 4: ilo, 5: ihi, 6: scale, 7: m, 8: v, 9: ldv, 10: 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 errors are negligible.

Further Comments

The total number of floating-point operations is approximately proportional to nm.
The complex analogue of this function is nag_lapack_zgebak (f08nw).

Example

See Example in nag_lapack_dgebal (f08nh).
function f08nj_example


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

n = int64(4);
a = [ 5.14, 0.91,  0.00, -32.80;
      0.91, 0.20,  0.00,  34.50;
      1.90, 0.80, -0.40,  -3.00;
     -0.33, 0.35,  0.00,   0.66];

% Balance a
[a, ilo, ihi, scale, info] = f08nh( ...
                                    'Both', a);

% Reduce a to upper Hessenberg form
[H, tau, info] = f08ne( ...
                        ilo, ihi, a);

% Form Q
[Q, info] = f08nf( ...
                   ilo, ihi, H, tau);

% Calculate the eigenvalues and Schur factorisation of A
[H, wr, wi, Z, info] = f08pe( ...
                              'Schur Form', 'Vectors', ilo, ihi, H, Q);

w = wr + i*wi;
disp('Eigenvalues:');
disp(w);

% Calculate the eigenvectors of A
[select, ~, VR, m, info] = ...
f08qk( ...
       'Right', 'Backtransform', false, H, zeros(1), Z, n);

% Back scale to get eigenvectors of A
[VR, info] = f08nj( ...
                    'Both', 'Right', ilo, ihi, scale, VR);

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

disp('Eigenvectors:');
disp(VR);


f08nj example results

Eigenvalues:
   -0.4000
   -4.0208
    3.0136
    7.0072

Eigenvectors:
         0   -0.4381    0.4654    0.9513
         0    0.8923    0.7888   -0.1714
    1.0000   -0.0481    0.3981    0.2494
         0   -0.0976    0.0521   -0.0589


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