org.ojalgo.matrix.decomposition
Class EigenvalueDecomposition<N extends Number>

java.lang.Object
  extended by org.ojalgo.matrix.decomposition.EigenvalueDecomposition<N>
All Implemented Interfaces:
Eigenvalue<N>, MatrixDecomposition<N>

public abstract class EigenvalueDecomposition<N extends Number>
extends Object
implements Eigenvalue<N>


Field Summary
static boolean DEBUG
           
 
Method Summary
 boolean compute(MatrixStore<N> aStore)
          Will check for symmetry and then call either computeSymmetric(MatrixStore) or computeNonsymmetric(MatrixStore).
 boolean computeNonsymmetric(MatrixStore<N> aSymmetric)
           
 boolean computeSymmetric(MatrixStore<N> aSymmetric)
           
 boolean equals(MatrixDecomposition<N> aDecomp, NumberContext aCntxt)
           
 boolean equals(MatrixStore<N> aStore, NumberContext aCntxt)
           
 boolean equals(Object someObj)
           
 MatrixStore<N> 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.
 MatrixStore<N> getInverse()
          The output must be a "right inverse" and a "generalised inverse".
 ComplexNumber getTrace()
          A matrix' trace is the sum of the diagonal elements.
 MatrixStore<N> getV()
          The columns of [V] represent the eigenvectors of [A] in the sense that [A][V] = [V][D].
 MatrixStore<N> invert(MatrixStore<N> 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()
           
static Eigenvalue<BigDecimal> makeBig()
           
static Eigenvalue<Double> makeJama()
           
static Eigenvalue<Double> makePrimitive()
           
 void reset()
           
 MatrixStore<N> solve(MatrixStore<N> aRHS)
           
 Future<DecomposeAndSolve<N>> solve(MatrixStore<N> aBody, MatrixStore<N> aRHS)
          Will solve [aBody][X]=[aRHS] concurrently by first calling MatrixDecomposition.compute(MatrixStore) using [aBody], and then MatrixDecomposition.solve(MatrixStore) using [aRHS].
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
equals, invert, isComputed, solve
 

Field Detail

DEBUG

public static boolean DEBUG
Method Detail

makeBig

public static final Eigenvalue<BigDecimal> makeBig()
Returns:
A BigDecimal adapter to PrimitiveEigenvalue.

makeJama

public static final Eigenvalue<Double> makeJama()

makePrimitive

public static final Eigenvalue<Double> makePrimitive()

compute

public final boolean compute(MatrixStore<N> aStore)
Will check for symmetry and then call either computeSymmetric(MatrixStore) or computeNonsymmetric(MatrixStore).

Specified by:
compute in interface MatrixDecomposition<N extends Number>
Parameters:
aStore - A matrix to decompose
Returns:
true if the computation suceeded; false if not
See Also:
MatrixDecomposition.compute(org.ojalgo.matrix.store.MatrixStore)

computeNonsymmetric

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

computeSymmetric

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

equals

public final boolean equals(MatrixStore<N> aStore,
                            NumberContext aCntxt)
Specified by:
equals in interface MatrixDecomposition<N extends Number>

getD

public final MatrixStore<N> 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<N extends Number>
Returns:
The (block) diagonal eigenvalue matrix.

getDeterminant

public final ComplexNumber getDeterminant()
Description copied from interface: Eigenvalue

A matrix' determinant is the product of its eigenvalues.

Specified by:
getDeterminant in interface Eigenvalue<N extends Number>
Returns:
The matrix' determinant

getEigenvalues

public final 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<N extends Number>
Returns:
The eigenvalues in an ordered array.

getInverse

public final MatrixStore<N> getInverse()
Description copied from interface: MatrixDecomposition
The output must be a "right inverse" and a "generalised inverse".

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

getTrace

public final 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<N extends Number>
Returns:
The matrix' trace

getV

public final MatrixStore<N> 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<N extends Number>
Returns:
The eigenvector matrix.

isFullSize

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

isOrdered

public final boolean isOrdered()
Specified by:
isOrdered in interface Eigenvalue<N extends Number>

isSolvable

public final boolean isSolvable()
Specified by:
isSolvable in interface MatrixDecomposition<N extends Number>
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 final boolean isSymmetric()
Specified by:
isSymmetric in interface Eigenvalue<N extends Number>

reset

public void reset()
Specified by:
reset in interface MatrixDecomposition<N extends Number>

solve

public final MatrixStore<N> solve(MatrixStore<N> aRHS)
Specified by:
solve in interface MatrixDecomposition<N extends Number>

equals

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

equals

public boolean equals(Object someObj)
Overrides:
equals in class Object

invert

public final MatrixStore<N> invert(MatrixStore<N> 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<N extends Number>

isComputed

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

solve

public Future<DecomposeAndSolve<N>> solve(MatrixStore<N> aBody,
                                          MatrixStore<N> 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<N extends Number>
Parameters:
aBody - The equation system body
aRHS - The equation system right hand side
Returns:
The matrix decomposition and the equation system solution, [X]