- java.lang.Object
-
- org.ojalgo.matrix.decomposition.AbstractDecomposition<java.lang.Double,R064Store>
-
- org.ojalgo.matrix.decomposition.RawDecomposition
-
- org.ojalgo.matrix.decomposition.RawEigenvalue
-
- All Implemented Interfaces:
Eigenvalue<java.lang.Double>,MatrixDecomposition<java.lang.Double>,MatrixDecomposition.Determinant<java.lang.Double>,MatrixDecomposition.Hermitian<java.lang.Double>,MatrixDecomposition.Ordered<java.lang.Double>,MatrixDecomposition.Values<java.lang.Double>,Provider2D,Provider2D.Determinant<java.lang.Double>,Provider2D.Eigenpairs,DeterminantTask<java.lang.Double>,MatrixTask<java.lang.Double>,Structure1D,Structure2D
- Direct Known Subclasses:
RawEigenvalue.Dynamic,RawEigenvalue.General,RawEigenvalue.Symmetric
abstract class RawEigenvalue extends RawDecomposition implements Eigenvalue<java.lang.Double>
Eigenvalues and eigenvectors of a real matrix.If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is diagonal and the eigenvector matrix V is orthogonal. I.e. A = V.times(D.times(V.transpose())) and V.times(V.transpose()) equals the identity matrix.
If A is not symmetric, then the eigenvalue matrix D is block diagonal with the real eigenvalues in 1-by-1 blocks and any complex eigenvalues, lambda + i*mu, in 2-by-2 blocks, [lambda, mu; -mu, lambda]. The columns of V represent the eigenvectors in the sense that A*V = V*D, i.e. A.times(V) equals V.times(D). The matrix V may be badly conditioned, or even singular, so the validity of the equation A = V*D*inverse(V) depends upon V.cond().
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classRawEigenvalue.Dynamic(package private) static classRawEigenvalue.General(package private) static classRawEigenvalue.Symmetric-
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>>, Eigenvalue.Spectral<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.Updatable<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.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 double[]dArrays for internal storage of eigenvalues.private double[]eArrays for internal storage of eigenvalues.private MatrixStore<java.lang.Double>myDprivate double[][]myTransposedVArray for internal storage of eigenvectors.private MatrixStore<java.lang.Double>myV-
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 protectedRawEigenvalue()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.DoublecalculateDeterminant(Access2D<?> matrix)protected booleancheckSolvability()booleancomputeValuesOnly(Access2D.Collectable<java.lang.Double,? super TransformableRegion<java.lang.Double>> matrix)booleandecompose(Access2D.Collectable<java.lang.Double,? super TransformableRegion<java.lang.Double>> matrix)protected abstract booleandoDecompose(double[][] data, boolean valuesOnly)(package private) voiddoGeneral(double[][] data, boolean valuesOnly)(package private) voiddoSymmetric(double[][] data, boolean valuesOnly)MatrixStore<java.lang.Double>getD()Return the block diagonal eigenvalue matrixjava.lang.DoublegetDeterminant()A matrix' determinant is the product of its eigenvalues.Array1D<ComplexNumber>getEigenvalues()Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers.voidgetEigenvalues(double[] realParts, java.util.Optional<double[]> imaginaryParts)(package private) double[]getImaginaryParts()Return the imaginary parts of the eigenvalues(package private) double[]getRealParts()Return the real parts of the eigenvaluesComplexNumbergetTrace()A matrix' trace is the sum of the diagonal elements.MatrixStore<java.lang.Double>getV()Return the eigenvector matrix(package private) booleanisValuesOnly()protected MatrixStore<java.lang.Double>makeD(double[] d, double[] e)voidreset()Delete computed results, and resets attributes to default values-
Methods inherited from class org.ojalgo.matrix.decomposition.RawDecomposition
checkSymmetry, getColDim, getInternalData, getInternalStore, getRowDim, make, newRawStore, reset, wrap
-
Methods inherited from class org.ojalgo.matrix.decomposition.AbstractDecomposition
aggregator, applyPivotOrder, applyReverseOrder, collect, computed, function, getDimensionalEpsilon, isAspectRatioNormal, isComputed, isSolvable, makeArray, makeDiagonal, makeEye, makeHouseholder, makeIdentity, makeRotation, makeRotation, makeZero, makeZero, scalar, wrap
-
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, getEigenvectors, isHermitian, isOrdered, reconstruct
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
isComputed
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Determinant
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, getColDim, getMaxDim, getMinDim, getRowDim, isEmpty, isFat, isScalar, isSquare, isTall, isVector, limitOfColumn, limitOfRow, size
-
-
-
-
Field Detail
-
d
private double[] d
Arrays for internal storage of eigenvalues.
-
e
private double[] e
Arrays for internal storage of eigenvalues.
-
myD
private transient MatrixStore<java.lang.Double> myD
-
myTransposedV
private double[][] myTransposedV
Array for internal storage of eigenvectors.
-
myV
private transient MatrixStore<java.lang.Double> myV
-
-
Method Detail
-
calculateDeterminant
public java.lang.Double calculateDeterminant(Access2D<?> matrix)
- Specified by:
calculateDeterminantin interfaceDeterminantTask<java.lang.Double>
-
computeValuesOnly
public boolean computeValuesOnly(Access2D.Collectable<java.lang.Double,? super TransformableRegion<java.lang.Double>> matrix)
- Specified by:
computeValuesOnlyin interfaceMatrixDecomposition.Values<java.lang.Double>- 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 boolean decompose(Access2D.Collectable<java.lang.Double,? super TransformableRegion<java.lang.Double>> matrix)
- Specified by:
decomposein interfaceMatrixDecomposition<java.lang.Double>- Parameters:
matrix- A matrix to decompose- Returns:
- true if decomposition suceeded; false if not
-
getD
public MatrixStore<java.lang.Double> getD()
Return the block diagonal eigenvalue matrix- Specified by:
getDin interfaceEigenvalue<java.lang.Double>- Returns:
- D
-
getDeterminant
public java.lang.Double getDeterminant()
Description copied from interface:MatrixDecomposition.DeterminantA matrix' determinant is the product of its eigenvalues.
- Specified by:
getDeterminantin interfaceMatrixDecomposition.Determinant<java.lang.Double>- Specified by:
getDeterminantin interfaceProvider2D.Determinant<java.lang.Double>- Returns:
- The matrix' determinant
-
getEigenvalues
public Array1D<ComplexNumber> getEigenvalues()
Description copied from interface:EigenvalueEven 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 are ordered or not is indicated by the
Eigenvalue.isOrdered()method.- Specified by:
getEigenvaluesin interfaceEigenvalue<java.lang.Double>- Returns:
- The eigenvalues.
-
getEigenvalues
public void getEigenvalues(double[] realParts, java.util.Optional<double[]> imaginaryParts)- Specified by:
getEigenvaluesin interfaceEigenvalue<java.lang.Double>- Parameters:
realParts- An array that will receive the real parts of the eigenvaluesimaginaryParts- An optional array that, if present, will receive the imaginary parts of the eigenvalues
-
getTrace
public ComplexNumber getTrace()
Description copied from interface:EigenvalueA 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:
getTracein interfaceEigenvalue<java.lang.Double>- Returns:
- The matrix' trace
-
getV
public MatrixStore<java.lang.Double> getV()
Return the eigenvector matrix- Specified by:
getVin interfaceEigenvalue<java.lang.Double>- Returns:
- V
-
reset
public void reset()
Description copied from interface:MatrixDecompositionDelete computed results, and resets attributes to default values- Specified by:
resetin interfaceMatrixDecomposition<java.lang.Double>- Overrides:
resetin classAbstractDecomposition<java.lang.Double,R064Store>
-
checkSolvability
protected boolean checkSolvability()
- Overrides:
checkSolvabilityin classAbstractDecomposition<java.lang.Double,R064Store>
-
doDecompose
protected abstract boolean doDecompose(double[][] data, boolean valuesOnly)
-
makeD
protected MatrixStore<java.lang.Double> makeD(double[] d, double[] e)
-
doGeneral
void doGeneral(double[][] data, boolean valuesOnly)
-
doSymmetric
void doSymmetric(double[][] data, boolean valuesOnly)
-
getImaginaryParts
double[] getImaginaryParts()
Return the imaginary parts of the eigenvalues- Returns:
- imag(diag(D))
-
getRealParts
double[] getRealParts()
Return the real parts of the eigenvalues- Returns:
- real(diag(D))
-
isValuesOnly
boolean isValuesOnly()
-
-