Servers
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:
*RWSchurEigServer<double> is the default server; it constructs the decomposition using a Schur decomposition.
*RWHessEigServer<double> determines the eigenvalues directly from a Hessenberg decomposition and then computes the eigenvectors using inverse iteration. The RWHessEigServer<double> 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 RWHessEigServer<double> to compute only the first five right eigenvectors:
 
#include <iostream>
#include <rw/lapack/eigsrv.h>
 
int main()
{
RWGenMat<double> A; // 1
std::cin >> A;
RWHessEigServer<double> server; // 2
server.computeLeftEigenVectors(true); // 3
server.selectEigenVectors(RWRange(0,4)); // 4
RWEigDecomp<double> decomp = server(A); // 5
std::cout << decomp.rightEigenVectors() << std::endl;
 
return 0;
}
//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.