org.ojalgo.matrix.jama
Class JamaEigenvalue

java.lang.Object
  extended by org.ojalgo.matrix.jama.JamaEigenvalue
All Implemented Interfaces:
Eigenvalue<Double>, MatrixDecomposition<Double>

public final class JamaEigenvalue
extends Object
implements Eigenvalue<Double>

This class adapts JAMA's EigenvalueDecomposition to ojAlgo's Eigenvalue interface.

Author:
apete

Constructor Summary
JamaEigenvalue()
           
 
Method Summary
 boolean compute(MatrixStore<Double> aStore)
           
 boolean computeNonsymmetric(MatrixStore<Double> aNonsymmetricStore)
           
 boolean computeSymmetric(MatrixStore<Double> aSymmetricStore)
           
 boolean equals(BasicMatrix aMtrx, NumberContext aCntxt)
           
 boolean equals(MatrixDecomposition<Double> aDecomp, NumberContext aCntxt)
           
 boolean equals(MatrixStore<Double> aStore, NumberContext aCntxt)
           
 JamaMatrix getD()
          The only requirements on [D] are that it should contain the eigenvalues and that [A][V] = [V][D].
 ComplexNumber getDeterminant()
           A matrix' determinant is the product of its eigenvalues.
 Array1D<ComplexNumber> getEigenvalues()
           Even for real matrices the eigenvalues are potentially complex numbers.
 JamaMatrix getInverse()
          The output must be a "right inverse" and a "generalised inverse".
 ComplexNumber getTrace()
          A matrix' trace is the sum of the diagonal elements.
 JamaMatrix getV()
          The columns of [V] represent the eigenvectors of [A] in the sense that [A][V] = [V][D].
 JamaMatrix invert(MatrixStore<Double> aStore)
          A convenience method that produces exactly the same result as if you first call MatrixDecomposition.compute(MatrixStore) and then MatrixDecomposition.getInverse().
 boolean isComputed()
           
 boolean isFullSize()
           
 boolean isOrdered()
           
 boolean isSolvable()
           
 boolean isSymmetric()
           
 void reset()
           
 JamaMatrix solve(MatrixStore<Double> aRHS)
           
 Future<DecomposeAndSolve<Double>> solve(MatrixStore<Double> aBody, MatrixStore<Double> aRHS)
          Will solve [aBody][X]=[aRHS] concurrently by first calling MatrixDecomposition.compute(MatrixStore) using [aBody], and then MatrixDecomposition.solve(MatrixStore) using [aRHS].
 String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
compute, equals, invert, solve
 

Constructor Detail

JamaEigenvalue

public JamaEigenvalue()
Method Detail

computeNonsymmetric

public boolean computeNonsymmetric(MatrixStore<Double> aNonsymmetricStore)
Specified by:
computeNonsymmetric in interface Eigenvalue<Double>
Parameters:
aNonsymmetricStore - A nonsymmetric (assumed to be) matrix to decompose
Returns:
true if the computation suceeded; false if not

computeSymmetric

public boolean computeSymmetric(MatrixStore<Double> aSymmetricStore)
Specified by:
computeSymmetric in interface Eigenvalue<Double>
Parameters:
aSymmetricStore - A symmetric (assumed to be) matrix to decompose
Returns:
true if the computation suceeded; false if not

equals

public boolean equals(MatrixStore<Double> aStore,
                      NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<Double>

getD

public JamaMatrix getD()
Description copied from interface: Eigenvalue
The only requirements on [D] are that it should contain the eigenvalues and that [A][V] = [V][D]. The ordering of the eigenvalues is not specified.

Specified by:
getD in interface Eigenvalue<Double>
Returns:
The (block) diagonal eigenvalue matrix.

getDeterminant

public ComplexNumber getDeterminant()
Description copied from interface: Eigenvalue

A matrix' determinant is the product of its eigenvalues.

Specified by:
getDeterminant in interface Eigenvalue<Double>
Returns:
The matrix' determinant

getEigenvalues

public Array1D<ComplexNumber> getEigenvalues()
Description copied from interface: Eigenvalue

Even for real matrices the eigenvalues are potentially complex numbers. Typically they need to be expressed as complex numbers when [A] is not symmetric.

The eigenvalues in this array should be ordered in descending order - largest (modulus) first.

Specified by:
getEigenvalues in interface Eigenvalue<Double>
Returns:
The eigenvalues in an ordered array.

getInverse

public JamaMatrix getInverse()
Description copied from interface: MatrixDecomposition
The output must be a "right inverse" and a "generalised inverse".

Specified by:
getInverse in interface MatrixDecomposition<Double>
See Also:
BasicMatrix.invert()

getTrace

public ComplexNumber getTrace()
Description copied from interface: Eigenvalue
A matrix' trace is the sum of the diagonal elements. It is also the sum of the eigenvalues. This method should return the sum of the eigenvalues.

Specified by:
getTrace in interface Eigenvalue<Double>
Returns:
The matrix' trace

getV

public JamaMatrix getV()
Description copied from interface: Eigenvalue
The columns of [V] represent the eigenvectors of [A] in the sense that [A][V] = [V][D].

Specified by:
getV in interface Eigenvalue<Double>
Returns:
The eigenvector matrix.

isComputed

public boolean isComputed()
Specified by:
isComputed in interface MatrixDecomposition<Double>
Returns:
true if computation has been attemped; false if not.
See Also:
MatrixDecomposition.compute(MatrixStore), MatrixDecomposition.isSolvable()

isFullSize

public boolean isFullSize()
Specified by:
isFullSize in interface MatrixDecomposition<Double>
Returns:
True if the implementation generates a full sized decomposition.

isOrdered

public boolean isOrdered()
Specified by:
isOrdered in interface Eigenvalue<Double>

isSolvable

public boolean isSolvable()
Specified by:
isSolvable in interface MatrixDecomposition<Double>
Returns:
true if it is ok to call MatrixDecomposition.solve(MatrixStore) (computation was successful); false if not
See Also:
MatrixDecomposition.solve(MatrixStore), MatrixDecomposition.isComputed()

isSymmetric

public boolean isSymmetric()
Specified by:
isSymmetric in interface Eigenvalue<Double>

reset

public void reset()
Specified by:
reset in interface MatrixDecomposition<Double>

solve

public JamaMatrix solve(MatrixStore<Double> aRHS)
Specified by:
solve in interface MatrixDecomposition<Double>

toString

public String toString()
Overrides:
toString in class Object

compute

public final boolean compute(MatrixStore<Double> aStore)
Specified by:
compute in interface MatrixDecomposition<Double>
Parameters:
aStore - A matrix to decompose
Returns:
true if the computation suceeded; false if not

equals

public final boolean equals(BasicMatrix aMtrx,
                            NumberContext aCntxt)

equals

public boolean equals(MatrixDecomposition<Double> aDecomp,
                      NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<Double>

invert

public final JamaMatrix invert(MatrixStore<Double> aStore)
Description copied from interface: MatrixDecomposition
A convenience method that produces exactly the same result as if you first call MatrixDecomposition.compute(MatrixStore) and then MatrixDecomposition.getInverse().

Specified by:
invert in interface MatrixDecomposition<Double>

solve

public final Future<DecomposeAndSolve<Double>> solve(MatrixStore<Double> aBody,
                                                     MatrixStore<Double> aRHS)
Description copied from interface: MatrixDecomposition
Will solve [aBody][X]=[aRHS] concurrently by first calling MatrixDecomposition.compute(MatrixStore) using [aBody], and then MatrixDecomposition.solve(MatrixStore) using [aRHS]. If either of the input [aBody] or [aRHS] is set to null the corresponing calculation is skipped.

Specified by:
solve in interface MatrixDecomposition<Double>
Parameters:
aBody - The equation system body
aRHS - The equation system right hand side
Returns:
The matrix decomposition and the equation system solution, [X]