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_dtrexc (f08qf)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dtrexc (f08qf) reorders the Schur factorization of a real general matrix.

Syntax

[t, q, ifst, ilst, info] = f08qf(compq, t, q, ifst, ilst, 'n', n)
[t, q, ifst, ilst, info] = nag_lapack_dtrexc(compq, t, q, ifst, ilst, 'n', n)

Description

nag_lapack_dtrexc (f08qf) reorders the Schur factorization of a real general matrix A=QTQT, so that the diagonal element or block of T with row index ifst is moved to row ilst.
The reordered Schur form T~ is computed by an orthogonal similarity transformation: T~=ZTTZ. Optionally the updated matrix Q~ of Schur vectors is computed as Q~=QZ, giving A=Q~T~Q~T.

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Parameters

Compulsory Input Parameters

1:     compq – string (length ≥ 1)
Indicates whether the matrix Q of Schur vectors is to be updated.
compq='V'
The matrix Q of Schur vectors is updated.
compq='N'
No Schur vectors are updated.
Constraint: compq='V' or 'N'.
2:     tldt: – double array
The first dimension of the array t must be at least max1,n.
The second dimension of the array t must be at least max1,n.
The n by n upper quasi-triangular matrix T in canonical Schur form, as returned by nag_lapack_dhseqr (f08pe).
3:     qldq: – double array
The first dimension, ldq, of the array q must satisfy
  • if compq='V', ldq max1,n ;
  • if compq='N', ldq1.
The second dimension of the array q must be at least max1,n if compq='V' and at least 1 if compq='N'.
If compq='V', q must contain the n by n orthogonal matrix Q of Schur vectors.
4:     ifst int64int32nag_int scalar
5:     ilst int64int32nag_int scalar
ifst and ilst must specify the reordering of the diagonal elements or blocks of T. The element or block with row index ifst is moved to row ilst by a sequence of exchanges between adjacent elements or blocks.
Constraint: 1ifstn and 1ilstn.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array t and the second dimension of the array t. (An error is raised if these dimensions are not equal.)
n, the order of the matrix T.
Constraint: n0.

Output Parameters

1:     tldt: – double array
The first dimension of the array t will be max1,n.
The second dimension of the array t will be max1,n.
t stores the updated matrix T~. See also Further Comments.
2:     qldq: – double array
The first dimension, ldq, of the array q will be
  • if compq='V', ldq= max1,n ;
  • if compq='N', ldq=1.
The second dimension of the array q will be max1,n if compq='V' and at least 1 if compq='N'.
If compq='V', q contains the updated matrix of Schur vectors.
If compq='N', q is not referenced.
3:     ifst int64int32nag_int scalar
4:     ilst int64int32nag_int scalar
If ifst pointed to the second row of a 2 by 2 block on entry, it is changed to point to the first row. ilst always points to the first row of the block in its final position (which may differ from its input value by ±1).
5:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: compq, 2: n, 3: t, 4: ldt, 5: q, 6: ldq, 7: ifst, 8: ilst, 9: work, 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.
W  info=1
Two adjacent diagonal elements or blocks could not be successfully exchanged. This error can only occur if the exchange involves at least one 2 by 2 block; it implies that the problem is very ill-conditioned, and that the eigenvalues of the two blocks are very close. On exit, T may have been partially reordered, and ilst points to the first row of the current position of the block being moved; Q (if requested) is updated consistently with T.

Accuracy

The computed matrix T~ is exactly similar to a matrix T+E, where
E2 = Oε T2 ,  
and ε is the machine precision.
Note that if a 2 by 2 diagonal block is involved in the reordering, its off-diagonal elements are in general changed; the diagonal elements and the eigenvalues of the block are unchanged unless the block is sufficiently ill-conditioned, in which case they may be noticeably altered. It is possible for a 2 by 2 block to break into two 1 by 1 blocks, i.e., for a pair of complex eigenvalues to become purely real. The values of real eigenvalues however are never changed by the reordering.

Further Comments

The total number of floating-point operations is approximately 6nr if compq='N', and 12nr if compq='V', where r=ifst-ilst.
The input matrix T must be in canonical Schur form, as is the output matrix T~. This has the following structure.
If all the computed eigenvalues are real, T is upper triangular and its diagonal elements are the eigenvalues.
If some of the computed eigenvalues form complex conjugate pairs, then T has 2 by 2 diagonal blocks. Each diagonal block has the form
tii ti,i+1 ti+1,i ti+1,i+1 = α β γ α  
where βγ<0. The corresponding eigenvalues are α±βγ.
The complex analogue of this function is nag_lapack_ztrexc (f08qt).

Example

This example reorders the Schur factorization of the matrix T so that the 2 by 2 block with row index 2 is moved to row 1, where
T = 0.80 -0.11 0.01 0.03 0.00 -0.10 0.25 0.35 0.00 -0.65 -0.10 0.20 0.00 0.00 0.00 -0.10 .  
function f08qf_example


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

% Block triangular matrix T from Schur factorization
t = [0.8, -0.11,  0.01,  0.03;
     0,   -0.11,  0.25,  0.35;
     0,   -0.65, -0.10,  0.20;
     0,    0,     0,    -0.10];

% Reorder T to move 2-by-2 block with index 2 to row 1
compq = 'No update';
q = [0];
ifst = int64(2);
ilst = int64(1);
[t, q, ifst, ilst, info] = f08qf( ...
				  compq, t, q, ifst, ilst);

disp('Reordered Schur Form');
disp(t);


f08qf example results

Reordered Schur Form
   -0.1050   -0.6465    0.0877    0.2054
    0.2513   -0.1050    0.0919    0.3480
         0         0    0.8000   -0.0113
         0         0         0   -0.1000


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