NAG CL Interface
f02gcc (complex_​gen_​eigsys)

Settings help

CL Name Style:


1 Purpose

f02gcc computes selected eigenvalues and eigenvectors of a complex general matrix.

2 Specification

#include <nag.h>
void  f02gcc (Nag_Select_Eigenvalues crit, Integer n, Complex a[], Integer tda, double wl, double wu, Integer mest, Integer *m, Complex w[], Complex v[], Integer tdv, NagError *fail)
The function may be called by the names: f02gcc, nag_eigen_complex_gen_eigsys or nag_complex_eigensystem_sel.

3 Description

f02gcc computes selected eigenvalues and the corresponding right eigenvectors of a complex general matrix A :
Ax i = λ i x i .  
Eigenvalues λ i may be selected either by modulus, satisfying:
w l | λ i | w u ,  
or by real part, satisfying:
w l Re( λ i ) w u .  

4 References

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

5 Arguments

1: crit Nag_Select_Eigenvalues Input
On entry: indicates the criterion for selecting eigenvalues:
  • if crit=Nag_Select_Modulus, then eigenvalues are selected according to their moduli: w l | λ i | w u .
  • if crit=Nag_Select_RealPart, then eigenvalues are selected according to their real parts: w l Re( λ i ) w u .
Constraint: crit=Nag_Select_Modulus or Nag_Select_RealPart.
2: n Integer Input
On entry: n , the order of the matrix A .
Constraint: n0 .
3: a[n×tda] Complex Input/Output
Note: the (i,j)th element of the matrix A is stored in a[(i-1)×tda+j-1].
On entry: the n × n general matrix A .
On exit: a contains the Hessenberg form of the balanced input matrix A (see Section 9).
4: tda Integer Input
On entry: the stride separating matrix column elements in the array a.
Constraint: tda max(1,n) .
5: wl double Input
6: wu double Input
On entry: w l and w u , the lower and upper bounds on the criterion for the selected eigenvalues.
Constraint: wu>wl .
7: mest Integer Input
On entry: mest must be an upper bound on m , the number of eigenvalues and eigenvectors selected. No eigenvectors are computed if mest<m .
Constraint: mest max(1,m) .
8: m Integer * Output
On exit: m , the number of eigenvalues actually selected.
9: w[max(1,n)] Complex Output
On exit: the first m elements of w hold the selected eigenvalues; elements from the index m to n-1 contain the other eigenvalues.
10: v[n×tdv] Complex Output
Note: the (i,j)th element of the matrix V is stored in v[(i-1)×tdv+j-1].
On exit: v contains the selected eigenvectors, with the i th column holding the eigenvector associated with the eigenvalue λ i (stored in w[i-1] ).
11: tdv Integer Input
On entry: the stride separating matrix column elements in the array v.
Constraint: tdvmest .
12: 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_2_INT_ARG_LT
On entry, tdv=value while mest=value . These arguments must satisfy tdvmest .
NE_2_REAL_ARG_LE
On entry, wu=value while wl=value . These arguments must satisfy wu>wl .
NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument crit had an illegal value.
NE_EIGVEC
Inverse iteration failed to compute all the specified eigenvectors. If an eigenvector failed to converge, the corresponding column of v is set to zero.
NE_INT_2
On entry, tda=value while n=value .
Constraint: tda max(1,n) .
NE_INT_ARG_LT
On entry, mest=value.
Constraint: mest1.
On entry, n=value.
Constraint: n0.
NE_QR_FAIL
The QR algorithm failed to compute all the eigenvalues. No eigenvectors have been computed.
NE_REQD_EIGVAL
There are more than mest eigenvalues in the specified range. The actual number of eigenvalues in the range is returned in m. No eigenvectors have been computed.
Rerun with the second dimension of v = mest m .

7 Accuracy

If λ i is an exact eigenvalue, and λ ~ i is the corresponding computed value, then
| λ ~ i - λ i | c (n) ε A 2 s i ,  
where c (n) is a modestly increasing function of n , ε is the machine precision, and s i is the reciprocal condition number of λ i ; A is the balanced form of the original matrix A , and A A .
If x i is the corresponding exact eigenvector, and x ~ i is the corresponding computed eigenvector, then the angle θ ( x ~ i , x i ) between them is bounded as follows:
θ ( x ~ i , x i ) c (n) ε A 2 sep i  
where sep i is the reciprocal condition number of x i .

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
f02gcc is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
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

f02gcc first balances the matrix, using a diagonal similarity transformation to reduce its norm; and then reduces the balanced matrix A to upper Hessenberg form H , using a unitary similarity transformation: A = QHQ H . The function uses the Hessenberg QR algorithm to compute all the eigenvalues of H , which are the same as the eigenvalues of A . It computes the eigenvectors of H which correspond to the selected eigenvalues, using inverse iteration. It premultiplies the eigenvectors by Q to form the eigenvectors of A ; and finally transforms the eigenvectors to those of the original matrix A .
Each eigenvector x is normalized so that x 2 = 1 , and the element of largest absolute value is real and positive.
The inverse iteration function may make a small perturbation to the real parts of close eigenvalues, and this may shift their moduli just outside the specified bounds. If you are relying on eigenvalues being within the bounds, you should test them on return from f02gcc.
The time taken by the function is approximately proportional to n 3 .
The function can be used to compute all eigenvalues and eigenvectors, by setting wl large and negative, and wu large and positive.

10 Example

To compute those eigenvalues of the matrix A whose moduli lie in the range [-5.5,+5.5] , and their corresponding eigenvectors, where
A = ( -3.97 - 5.04 i -4.11 + 3.70 i -0.34 + 1.01 i 1.29 - 0.86 i - 0.34 - 1.50 i - 1.52 - 0.43 i - 1.88 - 5.38 i 3.36 + 0.65 i - 3.31 - 3.85 i - 2.50 + 3.45 i - 0.88 - 1.08 i 0.64 - 1.48 i -1.10 + 0.82 i - 1.81 - 1.59 i - 3.25 + 1.33 i 1.57 - 3.44 i )  

10.1 Program Text

Program Text (f02gcce.c)

10.2 Program Data

Program Data (f02gcce.d)

10.3 Program Results

Program Results (f02gcce.r)