#include <Jacobi.h>
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 which takes in a gmMatrix3 as the matrix to be solved.
Definition at line 39 of file Jacobi.cpp. References init(). |
|
|
Constructor which takes in a double[3][3] as the matrix to be solved.
Definition at line 49 of file Jacobi.cpp. References init(). |
|
|
Constructor with takes in a TNT::Matrix as the matrix to be solved.
Definition at line 61 of file Jacobi.cpp. References init(). |
|
|
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(). |
|
|
Called by constructors to initialize the internal data fields.
Definition at line 29 of file Jacobi.cpp. References orig. Referenced by Jacobi(). |
|
|
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.
Definition at line 76 of file Jacobi.cpp. References colToRow(), MAXSWEEP, orig, values, vectors, and Z. Referenced by NewtonClassify::classify(). |
|
|
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(). |
|
|
Max # of times to sweep through the matrix.
Definition at line 22 of file Jacobi.cpp. Referenced by solve(). |
|
|
The original input matrix to solve.
|
|
|
The three eigen values solved.
Definition at line 54 of file Jacobi.h. Referenced by NewtonClassify::classify(), solve(), and sort(). |
|
|
The three eigen vectors solved.
Definition at line 53 of file Jacobi.h. Referenced by NewtonClassify::classify(), colToRow(), solve(), and sort(). |
1.3.4