NAG CL Interface
f08qgc (dtrsen)

Settings help

CL Name Style:


1 Purpose

f08qgc reorders the Schur factorization of a real general matrix so that a selected cluster of eigenvalues appears in the leading elements or blocks on the diagonal of the Schur form. The function also optionally computes the reciprocal condition numbers of the cluster of eigenvalues and/or the invariant subspace.

2 Specification

#include <nag.h>
void  f08qgc (Nag_OrderType order, Nag_JobType job, Nag_ComputeQType compq, const Nag_Boolean select[], Integer n, double t[], Integer pdt, double q[], Integer pdq, double wr[], double wi[], Integer *m, double *s, double *sep, NagError *fail)
The function may be called by the names: f08qgc, nag_lapackeig_dtrsen or nag_dtrsen.

3 Description

f08qgc reorders the Schur factorization of a real general matrix A=QTQT, so that a selected cluster of eigenvalues appears in the leading diagonal elements or blocks of the Schur form.
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.
Let T~= ( T11 T12 0 T22 ) , where the selected eigenvalues are precisely the eigenvalues of the leading m×m sub-matrix T11. Let Q~ be correspondingly partitioned as ( Q1 Q2 ) where Q1 consists of the first m columns of Q. Then AQ1=Q1T11, and so the m columns of Q1 form an orthonormal basis for the invariant subspace corresponding to the selected cluster of eigenvalues.
Optionally the function also computes estimates of the reciprocal condition numbers of the average of the cluster of eigenvalues and of the invariant subspace.

4 References

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

5 Arguments

1: order Nag_OrderType Input
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.1.3 in the Introduction to the NAG Library CL Interface for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2: job Nag_JobType Input
On entry: indicates whether condition numbers are required for the cluster of eigenvalues and/or the invariant subspace.
job=Nag_DoNothing
No condition numbers are required.
job=Nag_EigVals
Only the condition number for the cluster of eigenvalues is computed.
job=Nag_Subspace
Only the condition number for the invariant subspace is computed.
job=Nag_DoBoth
Condition numbers for both the cluster of eigenvalues and the invariant subspace are computed.
Constraint: job=Nag_DoNothing, Nag_EigVals, Nag_Subspace or Nag_DoBoth.
3: compq Nag_ComputeQType Input
On entry: indicates whether the matrix Q of Schur vectors is to be updated.
compq=Nag_UpdateSchur
The matrix Q of Schur vectors is updated.
compq=Nag_NotQ
No Schur vectors are updated.
Constraint: compq=Nag_UpdateSchur or Nag_NotQ.
4: select[dim] const Nag_Boolean Input
Note: the dimension, dim, of the array select must be at least max(1,n).
On entry: the eigenvalues in the selected cluster. To select a real eigenvalue λj, select[j-1] must be set Nag_TRUE. To select a complex conjugate pair of eigenvalues λj and λj+1 (corresponding to a 2×2 diagonal block), select[j-1] and/or select[j] must be set to Nag_TRUE. A complex conjugate pair of eigenvalues must be either both included in the cluster or both excluded. See also Section 9.
5: n Integer Input
On entry: n, the order of the matrix T.
Constraint: n0.
6: t[dim] double Input/Output
Note: the dimension, dim, of the array t must be at least max(1,pdt×n).
The (i,j)th element of the matrix T is stored in
  • t[(j-1)×pdt+i-1] when order=Nag_ColMajor;
  • t[(i-1)×pdt+j-1] when order=Nag_RowMajor.
On entry: the n×n upper quasi-triangular matrix T in canonical Schur form, as returned by f08pec. See also Section 9.
On exit: t is overwritten by the updated matrix T~.
7: pdt Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraint: pdt max(1,n) .
8: q[dim] double Input/Output
Note: the dimension, dim, of the array q must be at least
  • max(1,pdq×n) when compq=Nag_UpdateSchur;
  • 1 when compq=Nag_NotQ.
The (i,j)th element of the matrix Q is stored in
  • q[(j-1)×pdq+i-1] when order=Nag_ColMajor;
  • q[(i-1)×pdq+j-1] when order=Nag_RowMajor.
On entry: if compq=Nag_UpdateSchur, q must contain the n×n orthogonal matrix Q of Schur vectors, as returned by f08pec.
On exit: if compq=Nag_UpdateSchur, q contains the updated matrix of Schur vectors; the first m columns of Q form an orthonormal basis for the specified invariant subspace.
If compq=Nag_NotQ, q is not referenced.
9: pdq Integer Input
On entry: the stride separating row or column elements (depending on the value of order) in the array q.
Constraints:
  • if compq=Nag_UpdateSchur, pdq max(1,n) ;
  • if compq=Nag_NotQ, pdq1.
10: wr[dim] double Output
11: wi[dim] double Output
Note: the dimension, dim, of the arrays wr and wi must be at least max(1,n).
On exit: the real and imaginary parts, respectively, of the reordered eigenvalues of T~. The eigenvalues are stored in the same order as on the diagonal of T~; see Section 9 for details. Note that if a complex eigenvalue is sufficiently ill-conditioned, then its value may differ significantly from its value before reordering.
12: m Integer * Output
On exit: m, the dimension of the specified invariant subspace. The value of m is obtained by counting 1 for each selected real eigenvalue and 2 for each selected complex conjugate pair of eigenvalues (see select); 0mn.
13: s double * Output
On exit: if job=Nag_EigVals or Nag_DoBoth, s is a lower bound on the reciprocal condition number of the average of the selected cluster of eigenvalues. If m=0 or n, s=1; if fail.code= NE_REORDER (see Section 6), s is set to zero.
If job=Nag_DoNothing or Nag_Subspace, s is not referenced.
14: sep double * Output
On exit: if job=Nag_Subspace or Nag_DoBoth, sep is the estimated reciprocal condition number of the specified invariant subspace. If m=0 or n, sep=T; if fail.code= NE_REORDER (see Section 6), sep is set to zero.
If job=Nag_DoNothing or Nag_EigVals, sep is not referenced.
15: fail NagError * Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).

6 Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_ENUM_INT_2
On entry, compq=value, pdq=value and n=value.
Constraint: if compq=Nag_UpdateSchur, pdq max(1,n) ;
if compq=Nag_NotQ, pdq1.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pdq=value.
Constraint: pdq>0.
On entry, pdt=value.
Constraint: pdt>0.
NE_INT_2
On entry, pdt=value and n=value.
Constraint: pdt max(1,n) .
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_REORDER
The reordering of T failed because a selected eigenvalue was too close to an unselected eigenvalue.
The reordering of T failed because a selected eigenvalue was too close to an eigenvalue which was not selected; this error exit can only occur if at least one of the eigenvalues involved was complex. The problem is too ill-conditioned: consider modifying the selection of eigenvalues so that eigenvalues which are very close together are either all included in the cluster or all excluded. On exit, T may have been partially reordered, but wr, wi and Q (if requested) are updated consistently with T; s and sep (if requested) are both set to zero.

7 Accuracy

The computed matrix T~ is similar to a matrix (T+E), where
E2 = O(ε) T2 ,  
and ε is the machine precision.
s cannot underestimate the true reciprocal condition number by more than a factor of min(m,n-m). sep may differ from the true value by m(n-m). The angle between the computed invariant subspace and the true subspace is O(ε)A2sep .
Note that if a 2×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×2 block to break into two 1×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.

8 Parallelism and Performance

f08qgc makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

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 the diagonal elements of T~ are the eigenvalues; wr[i-1]=t~ii, for i=1,2,,n and wi[i-1]=0.0.
If some of the computed eigenvalues form complex conjugate pairs, then T~ has 2×2 diagonal blocks. Each diagonal block has the form
( t~ii t~i,i+1 t~i+1,i t~i+1,i+1 )= ( α β γ α )  
where βγ<0. The corresponding eigenvalues are α±βγ; wr[i-1]=wr[i]=α; wi[i-1]=+|βγ|; wi[i]=-wi[i-1].
The complex analogue of this function is f08quc.

10 Example

This example reorders the Schur factorization of the matrix A=QTQT such that the two real eigenvalues appear as the leading elements on the diagonal of the reordered matrix T~, where
T = ( 0.7995 -0.1144 0.0060 0.0336 0.0000 -0.0994 0.2478 0.3474 0.0000 -0.6483 -0.0994 0.2026 0.0000 0.0000 0.0000 -0.1007 )  
and
Q = ( 0.6551 0.1037 0.3450 0.6641 0.5236 -0.5807 -0.6141 -0.1068 -0.5362 -0.3073 -0.2935 0.7293 0.0956 0.7467 -0.6463 0.1249 ) .  
The example program for f08qgc illustrates the computation of error bounds for the eigenvalues.
The original matrix A is given in f08nfc.

10.1 Program Text

Program Text (f08qgce.c)

10.2 Program Data

Program Data (f08qgce.d)

10.3 Program Results

Program Results (f08qgce.r)