For both symmetric and nonsymmetric eigenvalue problems, you can increase your control over the computation of the decomposition by using an eigenvalue server object.
There are two nonsymmetric eigenvalue server classes:
DoubleSchurEigServer is the default server; it constructs the decomposition using a Schur decomposition.
DoubleHessEigServer determines the eigenvalues directly from a Hessenberg decomposition and then computes the eigenvectors using inverse iteration. The DoubleHessEigServer is preferred if you need only a few eigenvectors.
Both types of servers can be configured to return only selected eigenvectors. Here is how to use the DoubleHessEigServer to compute only the first five right eigenvectors:
#include <iostream.h> #include <rw/deigsrv.h> main() { RWGenMat<double> A; // 1 cin >> A; DoubleHessEigServer server; // 2 server.computeLeftEigenVectors(FALSE); // 3 server.selectEigenVectors(RWRange(0,4)); // 4 DoubleEigDecomp decomp = server(A); // 5 cout << decomp.rightEigenVectors() << endl; }
//1 | First the matrix is defined and read in from standard input. |
//2 | When the eigenvalue server is constructed, the algorithm parameters are all set to default values. |
//3 | Here we change the setting of a parameter so that the left eigenvectors are not computed. |
//4 | Here we set the range in which we are interested using a subscripting object. The string is used as a constructor to an RWSlice object. |
//5 | This computes the decomposition. |
©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.