NMath User's Guide

TOC |  Previous |  Next |  Index

21.3 Using the Eigenvalue Server Classes (.NET, C#, CSharp, Visual Basic, VB.NET)

The NMath eigenvalue server classes construct instances of the eigenvalue classes (Section 21.2), allowing you greater control over how the eigenvalue decomposition is performed. Servers can be configured to compute eigenvalues only, or both eigenvalues and eigenvectors. In addition, servers can be configured to compute only the eigenvalues in a given range. A tolerance for the convergence of the algorithm may also be specified.

Constructing Eigenvalue Servers

Instances of the eigenvalue server classes are constructed using a default constructor, then configured as desired. For example, this code creates a default DoubleSymEigDecompServer:

DoubleSymEigDecompServer server = new DoubleSymEigDecompServer();

Configuring Eigenvalue Servers

All eigenvalue server classes provide properties and member functions for configuring the server after construction:

NOTE- Eigenvalue ranges and tolerance are only provided for symmetric and Hermitian eigenvalue server classes. For general matrices, eigenvalues may be complex, and hence non-orderable.

For example, this code creates a default DoubleSymEigDecompServer, then configures the object not to compute eigenvectors, and only to compute eigenvalues within a specified range:

FloatSymEigDecompServer server = new FloatSymEigDecompServer();
server.ComputeLeftVectors = false;
server.ComputeRightVectors = false;
server.ComputeEigenValueRange( 0, 3 );

Creating Eigenvalue Objects from a Server

Eigenvalue server objects are used to create instances of the associated eigenvalue class, using the Factor() method. For instance, this code creates a FloatEigDecomp object from a configured FloatEigDecompServer:

FloatEigDecompServer eigServer = new FloatEigDecompServer(); 
eigServer.ComputeLeftVectors = false;
eigServer.ComputeRightVectors = false;
eigServer.Balance = BalanceOption.Permute;
FloatEigDecomp decomp = eigServer.Factor( A ); 

TOC |  Previous |  Next |  Index