Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Jacobi Class Reference

#include <Jacobi.h>

List of all members.


Detailed Description

The Jacobi class contains a method to solve for the eigen vectors and eigen values of a 3x3 matrix.

To use this class, you call one of the constructors using either a gmMatrix3, double[3][3], or TNT::Matrix<double> as the input matrix to solve. Next, call the solve() method to actually solve for eigen vectors/values. The resulting eigen vectors are stored in the gmMatrix3 member 'vectors', and the eigen values are stored in the gmVector3 member 'values'. The original matrix is preserved in the gmMatrix3 member 'orig' just in case you need that information after solving.

Note that the resulting eigen vectors are stored in row-major order for easy access. (This was not the case with the original jacobi code which required that you swap elements along the diagonal before use). Also, the resulting eigen vectors/values are NOT sorted by default. If you want your eigen vectors/values sorted in ascending order, you must call sort() after solve().

Definition at line 41 of file Jacobi.h.

Public Member Functions

 Jacobi (gmMatrix3)
 Constructor which takes in a gmMatrix3 as the matrix to be solved.

 Jacobi (double[3][3])
 Constructor which takes in a double[3][3] as the matrix to be solved.

 Jacobi (TNT::Matrix< double >)
 Constructor with takes in a TNT::Matrix as the matrix to be solved.

int solve ()
 Uses the input matrix to solve for eigen vectors and values.

void sort ()
 Sorts the eigen vectors based on eigen values, in ascending order.


Public Attributes

gmMatrix3 orig
 The original input matrix to solve.

gmMatrix3 vectors
 The three eigen vectors solved.

gmVector3 values
 The three eigen values solved.


Static Public Attributes

const int MAXSWEEP = 50
 Max # of times to sweep through the matrix.


Private Member Functions

void init (gmMatrix3)
 Called by constructors to initialize the internal data fields.

void colToRow ()
 Changes the matrix from column-major order to row-major order.


Constructor & Destructor Documentation

Jacobi::Jacobi gmMatrix3  mat  ) 
 

Constructor which takes in a gmMatrix3 as the matrix to be solved.

Parameters:
mat The matrix to run the Jacobi method on to solve for eigen vectors and eigen values.

Definition at line 39 of file Jacobi.cpp.

References init().

Jacobi::Jacobi double  mat[3][3]  ) 
 

Constructor which takes in a double[3][3] as the matrix to be solved.

Parameters:
mat The matrix to run the Jacobi method on to solve for eigen vectors and eigen values.

Definition at line 49 of file Jacobi.cpp.

References init().

Jacobi::Jacobi TNT::Matrix< double >  mat  ) 
 

Constructor with takes in a TNT::Matrix as the matrix to be solved.

Parameters:
mat The matrix to run the Jacobi method on to solve for eigen vectors and eigen values.

Definition at line 61 of file Jacobi.cpp.

References init().


Member Function Documentation

void Jacobi::colToRow  )  [private]
 

Changes the matrix from column-major order to row-major order.

This method is called from within solve just before the method returns to put the eigen vectors in row-major order.

Definition at line 229 of file Jacobi.cpp.

References vectors.

Referenced by solve().

void Jacobi::init gmMatrix3  mat  )  [private]
 

Called by constructors to initialize the internal data fields.

Parameters:
mat The matrix to run the Jacobi method on to solve for eigen vectors and eigen values.

Definition at line 29 of file Jacobi.cpp.

References orig.

Referenced by Jacobi().

int Jacobi::solve  ) 
 

Uses the input matrix to solve for eigen vectors and values.

Given a symetric 3x3 matrix (passed in during object construction), determine its eigenvalues (saved in values) and the eigenvectors (saved in vectors). The number of Jacobi rotations used is returned. See section 11.1 of Numerical Recipes in Pascal for more information.

Returns:
The number of Jacobi rotations used in solving.

Definition at line 76 of file Jacobi.cpp.

References colToRow(), MAXSWEEP, orig, values, vectors, and Z.

Referenced by NewtonClassify::classify().

void Jacobi::sort  ) 
 

Sorts the eigen vectors based on eigen values, in ascending order.

This is basically an expanded bubblesort for 3 values. The resulting eigen values/vectors will be sorted such that values[0]/vectors[0] has the smallest eigen value, and values[2]/vectors[2] has the largest eigen value.

Definition at line 200 of file Jacobi.cpp.

References values, and vectors.

Referenced by NewtonClassify::classify().


Member Data Documentation

const int Jacobi::MAXSWEEP = 50 [static]
 

Max # of times to sweep through the matrix.

Definition at line 22 of file Jacobi.cpp.

Referenced by solve().

gmMatrix3 Jacobi::orig
 

The original input matrix to solve.

Definition at line 52 of file Jacobi.h.

Referenced by init(), and solve().

gmVector3 Jacobi::values
 

The three eigen values solved.

Definition at line 54 of file Jacobi.h.

Referenced by NewtonClassify::classify(), solve(), and sort().

gmMatrix3 Jacobi::vectors
 

The three eigen vectors solved.

Definition at line 53 of file Jacobi.h.

Referenced by NewtonClassify::classify(), colToRow(), solve(), and sort().


The documentation for this class was generated from the following files:
Generated on Mon Jun 28 15:02:24 2004 for Advanced Surface Library by doxygen 1.3.4