Servers
An eigenvalue decomposition server object encapsulates the algorithm used to construct the decomposition. Server objects are very useful tools in object-oriented design; they tend to be especially useful in numerical applications due to the large number of parameters and the complexity associated with numerical algorithms. You can think of a server object as representing the same sort of thing as a regular C or C++ function, except that it is much more flexible. By including the traditional parameter list as part of an object's state, you can use member functions to set only those parameters that concern you. You can use inheritance to modify parts of algorithms that you want changed. You can have several instantiations of a server to represent the same algorithm, but with different parameters.
One of the most common reasons for using an eigenvalue server is that you require a specific algorithm for the computation. For example, if you know that A is a positive definite matrix, you might want to use the server RWSymPDQREigServer<double>, which uses a special variant of the QR algorithm especially designed for positive definite matrices. Here is an example program that does this:
 
#include <iostream>
#include <rw/lapack/symmat.h>
#include <rw/lapack/seigsrv.h>
 
int main()
{
RWSymMat<double> A;
std::cin >> A;
RWSymPDQREigServer<double> server; // 1
RWSymEigDecomp<double> decomp = server(A); // 2
std::cout << decomp.eigenValues() << std::endl;
std::cout << decomp.eigenVectors() << std::endl;
return 0;
}
//1 Here an explicit server object is constructed. In the previous example program, we did not construct a server; a default server was used instead. This is a nice example of how objects can do their work behind the scenes in a layered, orthogonal design.
//2 Here the server is used to compute the decomposition. By overloading the function call operator, using the server looks like a function call or a mathematical operator, depending on your point of view.
Table 8 provides a list of symmetric eigenvalue servers available in the Linear Algebra Module. Some of these are described in more detail in following sections.
Table 8 – Eigenvalue servers in the Linear Algebra Module
Server
Function
Abstract base class - commonalities implemented here
Basic QR method - this is the default
Positive definite QR - positive definite matrices only
Root free QR method
Bisection method to compute eigenvalues in a range
Bisection method to compute selected eigenvalues