Package org.ojalgo.matrix.decomposition
Class EigenvalueDecomposition<N extends 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 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 Comparable<N>>, Eigenvalue.Generalisation, Eigenvalue.Generalised<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
MatrixDecomposition.Determinant<N extends Comparable<N>>, MatrixDecomposition.EconomySize<N extends Comparable<N>>, MatrixDecomposition.Factory<D extends MatrixDecomposition<?>>, MatrixDecomposition.Hermitian<N extends Comparable<N>>, MatrixDecomposition.Ordered<N extends Comparable<N>>, MatrixDecomposition.Pivoting<N extends Comparable<N>>, MatrixDecomposition.RankRevealing<N extends Comparable<N>>, MatrixDecomposition.Solver<N extends Comparable<N>>, MatrixDecomposition.Values<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.matrix.Provider2D
Provider2D.Condition, Provider2D.Determinant<N extends Comparable<N>>, Provider2D.Eigenpairs, Provider2D.Hermitian, Provider2D.Inverse<M>, Provider2D.Rank, Provider2D.Solution<M>, Provider2D.Symmetric, Provider2D.Trace<N extends 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
FieldsModifier and TypeFieldDescriptionprivate MatrixStore
<N> private Array1D
<ComplexNumber> private int
private MatrixStore
<N> private boolean
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
ConstructorsModifierConstructorDescriptionprotected
EigenvalueDecomposition
(PhysicalStore.Factory<N, ? extends DecompositionStore<N>> aFactory) -
Method Summary
Modifier and TypeMethodDescriptioncalculateDeterminant
(Access2D<?> matrix) boolean
computeValuesOnly
(Access2D.Collectable<N, ? super PhysicalStore<N>> matrix) final boolean
decompose
(Access2D.Collectable<N, ? super PhysicalStore<N>> matrix) private final 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
final MatrixStore
<N> getD()
The only requirements on [D] are that it should contain the eigenvalues and that [A][V] = [V][D].final Array1D
<ComplexNumber> Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers.int
int
int
final 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> protected abstract MatrixStore
<N> makeV()
void
reset()
Delete computed results, and resets attributes to default values(package private) final void
setD
(MatrixStore<N> newD) (package private) final void
setEigenvalues
(Array1D<ComplexNumber> eigenvalues) (package private) final 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 Details
-
myD
-
myEigenvalues
-
mySquareDim
private int mySquareDim -
myV
-
myValuesOnly
private boolean myValuesOnly
-
-
Constructor Details
-
EigenvalueDecomposition
protected EigenvalueDecomposition(PhysicalStore.Factory<N, ? extends DecompositionStore<N>> aFactory)
-
-
Method Details
-
sort
Sort eigenvalues and corresponding vectors. -
calculateDeterminant
- Specified by:
calculateDeterminant
in interfaceDeterminantTask<N extends Comparable<N>>
-
computeValuesOnly
- Specified by:
computeValuesOnly
in interfaceMatrixDecomposition.Values<N extends 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
- Specified by:
decompose
in interfaceMatrixDecomposition<N extends 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
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 Comparable<N>>
- Returns:
- The (block) diagonal eigenvalue matrix.
-
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 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
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 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 Comparable<N>>
- Overrides:
reset
in classAbstractDecomposition<N extends 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
-
makeEigenvalues
-
makeV
-
setD
-
setEigenvalues
-
setV
-