gov.sandia.cognition.math.matrix.decomposition
Class AbstractEigenDecomposition

java.lang.Object
  extended by gov.sandia.cognition.math.matrix.decomposition.AbstractEigenDecomposition
All Implemented Interfaces:
EigenDecomposition
Direct Known Subclasses:
EigenDecompositionRightMTJ

@CodeReview(reviewer="Jonathan McClain",
            date="2006-05-16",
            changesNeeded=true,
            comments={"Comments indicated by triple slashes","Some refactoring needed here.","Another review needed after refactoring."},
            response={@CodeReviewResponse(respondent="Kevin R. Dixon",date="2006-05-17",moreChangesNeeded=true,comments="Fixes from J.T.\'s code review"),@CodeReviewResponse(respondent="Jonathan McClain",date="2006-05-17",moreChangesNeeded=false,comments="Rechecking after changes were made. Looks good now.")})
public abstract class AbstractEigenDecomposition
extends Object
implements EigenDecomposition

Abstract partial implementation of the EigenDecomposition interface

Since:
1.0
Author:
Kevin R. Dixon

Constructor Summary
protected AbstractEigenDecomposition(ComplexNumber[] eigenValues, Matrix eigenVectorsRealPart, Matrix eigenVectorsImaginaryPart)
          Stores the given eigenvalues and eigenvectors internally, the eigenvalues and eigenvectors will not be sorted.
protected AbstractEigenDecomposition(ComplexNumber[] eigenValues, Matrix eigenVectorsRealPart, Matrix eigenVectorsImaginaryPart, boolean sort)
          Creates a new eigendecomposition using the given eigenvalues and eigenvectors...
 
Method Summary
 ComplexNumber getEigenValue(int index)
          gets the indexed eigenvalue
 ComplexNumber[] getEigenValues()
          Getter for eigenValues
 Matrix getEigenVectorsImaginaryPart()
          gets the imaginary part of the eienvector, where the ith eigenvector is the ith column
 Matrix getEigenVectorsRealPart()
          getter for eigenvectorsrealPart
 ComplexNumber getLogDeterminant()
          Computes the natural logarithm determinant from the collection of eigenvalues
protected  void setEigenDecomposition(ComplexNumber[] eigenValues, Matrix eigenVectorsRealPart, Matrix eigenVectorsImaginaryPart, boolean sort)
          Sets the eigen decomposition for this
protected  void setEigenValues(ComplexNumber[] eigenValues)
          setter for eigenValues
 void setEigenVectorsImaginaryPart(Matrix eigenVectorsImaginaryPart)
          setter for the imaginary part of the eienvector, where the ith eigenvector is the ith column
protected  void setEigenVectorsRealPart(Matrix eigenVectorsRealPart)
          setter for eigenVectorsRealPart, where the ith eigenvector is the ith column
protected  void setUnsortedEigenDecomposition(ComplexNumber[] eigenValues, Matrix eigenVectorsRealPart, Matrix eigenVectorsImaginaryPart)
          Creates a new eigendecomposition using the given eigenvalues and eigenvectors...
protected  void sortAndSetEigenDecomposition(ComplexNumber[] eigenValues, Matrix eigenVectorsRealPart, Matrix eigenVectorsImaginaryPart)
          Sorts the eigendecomposition in descending order of the value of the magnitudes of the eigenvalues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEigenDecomposition

protected AbstractEigenDecomposition(ComplexNumber[] eigenValues,
                                     Matrix eigenVectorsRealPart,
                                     Matrix eigenVectorsImaginaryPart)
Stores the given eigenvalues and eigenvectors internally, the eigenvalues and eigenvectors will not be sorted.

Parameters:
eigenValues - array of complex-valued eigenvalue
eigenVectorsRealPart - matrix of the real parts of the eigenvectors
eigenVectorsImaginaryPart - matrix of the imaginary parts of the eigenvectors

AbstractEigenDecomposition

protected AbstractEigenDecomposition(ComplexNumber[] eigenValues,
                                     Matrix eigenVectorsRealPart,
                                     Matrix eigenVectorsImaginaryPart,
                                     boolean sort)
Creates a new eigendecomposition using the given eigenvalues and eigenvectors... this does not specify if the eigenvectors are the right or left eigenvectors. That should be done in a subclass implementation.

Parameters:
eigenValues - array of complex-valued eigenvalues to store
eigenVectorsRealPart - matrix where the ith column of the matrix contains the real part of the ith eigenvector of the underlying matrix
eigenVectorsImaginaryPart - matrix where the ith column of the matrix contains the real part of the ith eigenvector of the underlying matrix
sort - if true, then the constructor will sort the eigenvectors and eigenvectors by descending magnitude of the eigenvalue. In this case, eigenValues[0] will be the largest magnitude and eigenVectors(:,0) is its corresponding eigenvector.
Method Detail

setEigenDecomposition

protected void setEigenDecomposition(ComplexNumber[] eigenValues,
                                     Matrix eigenVectorsRealPart,
                                     Matrix eigenVectorsImaginaryPart,
                                     boolean sort)
Sets the eigen decomposition for this

Parameters:
eigenValues - array of eigenvalues for the underlying matrix
eigenVectorsRealPart - real part of the eigenvectors for the underlying matrix
eigenVectorsImaginaryPart - imaginary part of the eigenvalues for the underlying matrix
sort - true to sort eigen values/vectors by descending order of magnitude of the eigenvalues

sortAndSetEigenDecomposition

protected void sortAndSetEigenDecomposition(ComplexNumber[] eigenValues,
                                            Matrix eigenVectorsRealPart,
                                            Matrix eigenVectorsImaginaryPart)
Sorts the eigendecomposition in descending order of the value of the magnitudes of the eigenvalues

Parameters:
eigenValues - array of eigenvalues for the underlying matrix
eigenVectorsRealPart - real part of the eigenvectors for the underlying matrix
eigenVectorsImaginaryPart - imaginary part of the eigenvalues for the underlying matrix

setUnsortedEigenDecomposition

protected void setUnsortedEigenDecomposition(ComplexNumber[] eigenValues,
                                             Matrix eigenVectorsRealPart,
                                             Matrix eigenVectorsImaginaryPart)
Creates a new eigendecomposition using the given eigenvalues and eigenvectors... this does not specify if the eigenvectors are the right or left eigenvectors. That should be done in a subclass implementation.

Parameters:
eigenValues - array of eigenvalues for the underlying matrix
eigenVectorsRealPart - real part of the eigenvectors for the underlying matrix
eigenVectorsImaginaryPart - imaginary part of the eigenvalues for the underlying matrix

getEigenValues

public ComplexNumber[] getEigenValues()
Getter for eigenValues

Specified by:
getEigenValues in interface EigenDecomposition
Returns:
eigenValues

setEigenValues

protected void setEigenValues(ComplexNumber[] eigenValues)
setter for eigenValues

Parameters:
eigenValues - eigenvalues to set

getEigenValue

public ComplexNumber getEigenValue(int index)
gets the indexed eigenvalue

Specified by:
getEigenValue in interface EigenDecomposition
Parameters:
index - zero-based index into the eigenvalue array
Returns:
index eigenvalue

getEigenVectorsRealPart

public Matrix getEigenVectorsRealPart()
getter for eigenvectorsrealPart

Specified by:
getEigenVectorsRealPart in interface EigenDecomposition
Returns:
real part of the eienvector, where the ith eigenvector is the ith column

setEigenVectorsRealPart

protected void setEigenVectorsRealPart(Matrix eigenVectorsRealPart)
setter for eigenVectorsRealPart, where the ith eigenvector is the ith column

Parameters:
eigenVectorsRealPart - real part of the eienvector, where the ith eigenvector is the ith column

getEigenVectorsImaginaryPart

public Matrix getEigenVectorsImaginaryPart()
gets the imaginary part of the eienvector, where the ith eigenvector is the ith column

Specified by:
getEigenVectorsImaginaryPart in interface EigenDecomposition
Returns:
imaginary part of the eienvector, where the ith eigenvector is the ith column

setEigenVectorsImaginaryPart

public void setEigenVectorsImaginaryPart(Matrix eigenVectorsImaginaryPart)
setter for the imaginary part of the eienvector, where the ith eigenvector is the ith column

Parameters:
eigenVectorsImaginaryPart - imaginary part of the eienvector, where the ith eigenvector is the ith column

getLogDeterminant

public ComplexNumber getLogDeterminant()
Computes the natural logarithm determinant from the collection of eigenvalues

Specified by:
getLogDeterminant in interface EigenDecomposition
Returns:
natural logarithm of the determinant