jme.math
Class EigenSystem

java.lang.Object
  extended byjme.math.EigenSystem

public class EigenSystem
extends java.lang.Object

EigenSystem defines a system of eigen values and associated eigen vectors that solves the case AX = (alpha)X where (A - alpha(I)) = 0. The numerical approach used is to apply orthogonal transformations (Householder transformations) to reduce A to a tridiagonal matrix. The QL algorithm than shifts the matrix to a diagonal one.

NOTE: See 3D Game Engine Design. David H. Eberly. Also, JAMA.

Version:
$Id: EigenSystem.java,v 1.2 2003/08/21 20:57:18 mojomonkey Exp $
Author:
Mark Powell

Constructor Summary
EigenSystem(float[][] matrix)
          Constructor instantiates a new EigenSystem object from a supplied matrix.
 
Method Summary
 void decreasingSort()
          decreasingSort sorts eigenvalues and their associated eigenvectors in order of largest to smallest.
 float getEigenvector(int row, int col)
          getEigenVector returns a single element of an eigenvector.
 float[][] getEigenvectors()
          getEigenvectors returns the complete matrix of eigenvectors.
 float[] getImaginaryEigenValue()
          getImaginaryEigenvalue returns the imaginary components of the eigenvalues.
 float getImaginaryEigenValue(int i)
          getImaginaryEigenvalue returns a single eigenvalue defined by the parameter index.
 float[] getRealEigenvalue()
          getRealEigenvalue returns the real components of the eigenvalues.
 float getRealEigenvalue(int i)
          getRealEigenvalue returns a single eigenvalue defined by the parameter index.
 void increasingSort()
          increasingSort sorts eigenvalues and their associated eigenvectors in order of smallest to largest.
static void main(java.lang.String[] args)
          Main method used for testing.
 void tridiagonalQL()
          tridiagonalQL reduces the tridiagonal matrix to a diagonal one using the QL algorithm.
 void tridiagonalReduction()
          tridiagonalReduction reduces the matrix to a tridiagonal matrix using the Householder transformations.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EigenSystem

public EigenSystem(float[][] matrix)
Constructor instantiates a new EigenSystem object from a supplied matrix. Where the matrix is A in the equation: AX = (alpha)X. It is assumed that the supplied matrix is symmetric and a check for such will occur during instantiation. If the matrix is not symmetric, the eigenvalues and eigen vectors will not be calculated.

Parameters:
matrix - the square matrix to create the eigen system from.
Method Detail

decreasingSort

public void decreasingSort()
decreasingSort sorts eigenvalues and their associated eigenvectors in order of largest to smallest. Such that e[0] >= ... >= e[size - 1].


increasingSort

public void increasingSort()
increasingSort sorts eigenvalues and their associated eigenvectors in order of smallest to largest. Such that e[0] <= ... <= e[size - 1].


tridiagonalReduction

public void tridiagonalReduction()
tridiagonalReduction reduces the matrix to a tridiagonal matrix using the Householder transformations.


tridiagonalQL

public void tridiagonalQL()
tridiagonalQL reduces the tridiagonal matrix to a diagonal one using the QL algorithm.


getEigenvector

public float getEigenvector(int row,
                            int col)
getEigenVector returns a single element of an eigenvector. The element is defined by the row and column requested.

Parameters:
row - the row of the eigenvectors
col - the column of the eigenvectors
Returns:
the eigenvector value.

getEigenvectors

public float[][] getEigenvectors()
getEigenvectors returns the complete matrix of eigenvectors.

Returns:
the complete matrix of eigenvectors.

getRealEigenvalue

public float[] getRealEigenvalue()
getRealEigenvalue returns the real components of the eigenvalues.

Returns:
the real components of the eigenvalues.

getRealEigenvalue

public float getRealEigenvalue(int i)
getRealEigenvalue returns a single eigenvalue defined by the parameter index.

Parameters:
i - the eigenvalue desired.
Returns:
the eigenvalue referenced by the parameter index.

getImaginaryEigenValue

public float[] getImaginaryEigenValue()
getImaginaryEigenvalue returns the imaginary components of the eigenvalues.

Returns:
the imaginary components of the eigenvalues.

getImaginaryEigenValue

public float getImaginaryEigenValue(int i)
getImaginaryEigenvalue returns a single eigenvalue defined by the parameter index.

Parameters:
i - the eigenvalue desired.
Returns:
the eigenvalue referenced by the parameter index.

main

public static void main(java.lang.String[] args)
Main method used for testing. Creates a simple matrix and calculates the eigenvalues and eigenvectors.

Parameters:
args - command line arguments.