Package org.ojalgo.matrix.decomposition
Class EigenvalueDecomposition<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.matrix.decomposition.AbstractDecomposition<N>
-
- org.ojalgo.matrix.decomposition.GenericDecomposition<N>
-
- org.ojalgo.matrix.decomposition.EigenvalueDecomposition<N>
-
- All Implemented Interfaces:
Eigenvalue<N>
,MatrixDecomposition<N>
,MatrixDecomposition.Determinant<N>
,MatrixDecomposition.Hermitian<N>
,MatrixDecomposition.Ordered<N>
,MatrixDecomposition.Values<N>
,Provider2D
,Provider2D.Determinant<N>
,Provider2D.Eigenpairs
,DeterminantTask<N>
,MatrixTask<N>
,Structure1D
,Structure2D
- Direct Known Subclasses:
DynamicEvD
,GeneralEvD
,GeneralisedEvD
,HermitianEvD
abstract class EigenvalueDecomposition<N extends java.lang.Comparable<N>> extends GenericDecomposition<N> implements Eigenvalue<N>
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.Eigenvalue
Eigenvalue.Eigenpair, Eigenvalue.Factory<N extends java.lang.Comparable<N>>, Eigenvalue.Generalisation, Eigenvalue.Generalised<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
MatrixDecomposition.Determinant<N extends java.lang.Comparable<N>>, MatrixDecomposition.EconomySize<N extends java.lang.Comparable<N>>, MatrixDecomposition.Factory<D extends MatrixDecomposition<?>>, MatrixDecomposition.Hermitian<N extends java.lang.Comparable<N>>, MatrixDecomposition.Ordered<N extends java.lang.Comparable<N>>, MatrixDecomposition.Pivoting<N extends java.lang.Comparable<N>>, MatrixDecomposition.RankRevealing<N extends java.lang.Comparable<N>>, MatrixDecomposition.Solver<N extends java.lang.Comparable<N>>, MatrixDecomposition.Values<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.matrix.Provider2D
Provider2D.Condition, Provider2D.Determinant<N extends java.lang.Comparable<N>>, Provider2D.Eigenpairs, Provider2D.Hermitian, Provider2D.Inverse<M>, Provider2D.Rank, Provider2D.Solution<M>, Provider2D.Symmetric, Provider2D.Trace<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure1D
Structure1D.BasicMapper<T>, Structure1D.IndexMapper<T>, Structure1D.IntIndex, Structure1D.LongIndex, Structure1D.LoopCallback
-
Nested classes/interfaces inherited from interface org.ojalgo.structure.Structure2D
Structure2D.IntRowColumn, Structure2D.Logical<S extends Structure2D,B extends Structure2D.Logical<S,B>>, Structure2D.LongRowColumn, Structure2D.ReducibleTo1D<R extends Structure1D>, Structure2D.Reshapable, Structure2D.RowColumnKey<R,C>, Structure2D.RowColumnMapper<R,C>
-
-
Field Summary
Fields Modifier and Type Field Description private MatrixStore<N>
myD
private Array1D<ComplexNumber>
myEigenvalues
private int
mySquareDim
private MatrixStore<N>
myV
private boolean
myValuesOnly
-
Fields inherited from interface org.ojalgo.matrix.decomposition.Eigenvalue
C128, DESCENDING_NORM, H256, Q128, R064, R128
-
Fields inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
TYPICAL
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EigenvalueDecomposition(PhysicalStore.Factory<N,? extends DecompositionStore<N>> aFactory)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description N
calculateDeterminant(Access2D<?> matrix)
boolean
computeValuesOnly(Access2D.Collectable<N,? super PhysicalStore<N>> matrix)
boolean
decompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix)
private boolean
decompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean valuesOnly)
protected abstract boolean
doDecompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean valuesOnly)
int
getColDim()
MatrixStore<N>
getD()
The only requirements on [D] are that it should contain the eigenvalues and that [A][V] = [V][D].Array1D<ComplexNumber>
getEigenvalues()
Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers.int
getMaxDim()
int
getMinDim()
int
getRowDim()
MatrixStore<N>
getV()
The columns of [V] represent the eigenvectors of [A] in the sense that [A][V] = [V][D].protected abstract MatrixStore<N>
makeD()
protected abstract Array1D<ComplexNumber>
makeEigenvalues()
protected abstract MatrixStore<N>
makeV()
void
reset()
Delete computed results, and resets attributes to default values(package private) void
setD(MatrixStore<N> newD)
(package private) void
setEigenvalues(Array1D<ComplexNumber> eigenvalues)
(package private) void
setV(MatrixStore<N> newV)
(package private) static void
sort(double[] d, ExchangeColumns mtrxV)
Sort eigenvalues and corresponding vectors.-
Methods inherited from class org.ojalgo.matrix.decomposition.GenericDecomposition
aggregator, allocate, collect, copy, function, makeArray, makeDiagonal, makeEye, makeHouseholder, makeIdentity, makeRotation, makeRotation, makeZero, makeZero, scalar, wrap
-
Methods inherited from class org.ojalgo.matrix.decomposition.AbstractDecomposition
checkSolvability, computed, countColumns, countRows, getDimensionalEpsilon, isAspectRatioNormal, isComputed, isSolvable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ojalgo.matrix.decomposition.Eigenvalue
getEigenpair, getEigenpairs, getEigenvalues, getEigenvectors, getTrace, isHermitian, isOrdered, reconstruct
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
isComputed
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Determinant
getDeterminant, toDeterminantProvider
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Hermitian
checkAndDecompose
-
Methods inherited from interface org.ojalgo.structure.Structure2D
count, countColumns, countRows, firstInColumn, firstInRow, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Field Detail
-
myD
private MatrixStore<N extends java.lang.Comparable<N>> myD
-
myEigenvalues
private Array1D<ComplexNumber> myEigenvalues
-
mySquareDim
private int mySquareDim
-
myV
private MatrixStore<N extends java.lang.Comparable<N>> myV
-
myValuesOnly
private boolean myValuesOnly
-
-
Constructor Detail
-
EigenvalueDecomposition
protected EigenvalueDecomposition(PhysicalStore.Factory<N,? extends DecompositionStore<N>> aFactory)
-
-
Method Detail
-
sort
static void sort(double[] d, ExchangeColumns mtrxV)
Sort eigenvalues and corresponding vectors.
-
calculateDeterminant
public N calculateDeterminant(Access2D<?> matrix)
- Specified by:
calculateDeterminant
in interfaceDeterminantTask<N extends java.lang.Comparable<N>>
-
computeValuesOnly
public boolean computeValuesOnly(Access2D.Collectable<N,? super PhysicalStore<N>> matrix)
- Specified by:
computeValuesOnly
in interfaceMatrixDecomposition.Values<N extends java.lang.Comparable<N>>
- Parameters:
matrix
- The matrix to decompose- Returns:
- The same as
MatrixDecomposition.Solver.compute(Collectable)
orMatrixDecomposition.decompose(Collectable)
if the instance does not implementMatrixDecomposition.Solver
.
-
decompose
public final boolean decompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix)
- Specified by:
decompose
in interfaceMatrixDecomposition<N extends java.lang.Comparable<N>>
- Parameters:
matrix
- A matrix to decompose- Returns:
- true if decomposition suceeded; false if not
-
getColDim
public int getColDim()
- Specified by:
getColDim
in interfaceStructure2D
- Returns:
- The number of columns
-
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.- If [A] is real and symmetric then [D] is (purely) diagonal with real eigenvalues.
- If [A] is real but not symmetric then [D] is block-diagonal with real eigenvalues in 1-by-1 blocks and complex eigenvalues in 2-by-2 blocks.
- If [A] is complex then [D] is (purely) diagonal with complex eigenvalues.
- Specified by:
getD
in interfaceEigenvalue<N extends java.lang.Comparable<N>>
- Returns:
- The (block) diagonal eigenvalue matrix.
-
getEigenvalues
public final Array1D<ComplexNumber> getEigenvalues()
Description copied from interface:Eigenvalue
Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers. Typically they need to be expressed as complex numbers when [A] is not symmetric.
The values should be in the same order as the matrices "V" and "D", and if they is ordered or not is indicated by the
Eigenvalue.isOrdered()
method.- Specified by:
getEigenvalues
in interfaceEigenvalue<N extends java.lang.Comparable<N>>
- Returns:
- The eigenvalues.
-
getMaxDim
public int getMaxDim()
- Specified by:
getMaxDim
in interfaceStructure2D
-
getMinDim
public int getMinDim()
- Specified by:
getMinDim
in interfaceStructure2D
-
getRowDim
public int getRowDim()
- Specified by:
getRowDim
in interfaceStructure2D
- Returns:
- The number of rows
-
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 interfaceEigenvalue<N extends java.lang.Comparable<N>>
- Returns:
- The eigenvector matrix.
-
reset
public void reset()
Description copied from interface:MatrixDecomposition
Delete computed results, and resets attributes to default values- Specified by:
reset
in interfaceMatrixDecomposition<N extends java.lang.Comparable<N>>
- Overrides:
reset
in classAbstractDecomposition<N extends java.lang.Comparable<N>>
-
decompose
private final boolean decompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean valuesOnly)
-
doDecompose
protected abstract boolean doDecompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean valuesOnly)
-
makeD
protected abstract MatrixStore<N> makeD()
-
makeEigenvalues
protected abstract Array1D<ComplexNumber> makeEigenvalues()
-
makeV
protected abstract MatrixStore<N> makeV()
-
setD
final void setD(MatrixStore<N> newD)
-
setEigenvalues
final void setEigenvalues(Array1D<ComplexNumber> eigenvalues)
-
setV
final void setV(MatrixStore<N> newV)
-
-