public abstract class HermitianEvD<N extends Number> extends Object implements MatrixDecomposition.Solver<N>
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().
MatrixDecomposition.Determinant<N extends Number>, MatrixDecomposition.EconomySize<N extends Number>, MatrixDecomposition.Factory<D extends MatrixDecomposition<?>>, MatrixDecomposition.Hermitian<N extends Number>, MatrixDecomposition.Ordered<N extends Number>, MatrixDecomposition.RankRevealing<N extends Number>, MatrixDecomposition.Solver<N extends Number>, MatrixDecomposition.Values<N extends Number>SolverTask.Factory<N extends Number>InverterTask.Factory<N extends Number>Eigenvalue.Eigenpair, Eigenvalue.Factory<N extends Number>TYPICALBIG, COMPLEX, PRIMITIVE, QUATERNION, RATIONALBIG, COMPLEX, PRIMITIVE, QUATERNION, RATIONALBIG, COMPLEX, PRIMITIVE, QUATERNION, RATIONAL| Modifier | Constructor and Description |
|---|---|
protected |
HermitianEvD(PhysicalStore.Factory<N,? extends DecompositionStore<N>> aFactory,
org.ojalgo.matrix.decomposition.TridiagonalDecomposition<N> tridiagonal) |
| Modifier and Type | Method and Description |
|---|---|
protected AggregatorSet<N> |
aggregator() |
protected DecompositionStore<N> |
allocate(long numberOfRows,
long numberOfColumns) |
protected boolean |
aspectRatioNormal(boolean aspectRatioNormal) |
N |
calculateDeterminant(Access2D<?> matrix) |
boolean |
checkAndCompute(MatrixStore<N> matrix)
Absolutely must check if the matrix is hermitian or not.
|
protected boolean |
checkSolvability() |
protected MatrixStore<N> |
collect(Access2D.Collectable<N,? super DecompositionStore<N>> source) |
protected boolean |
computed(boolean computed) |
boolean |
computeValuesOnly(Access2D.Collectable<N,? super PhysicalStore<N>> matrix) |
protected DecompositionStore<N> |
copy(Access2D<?> source) |
boolean |
decompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix) |
protected boolean |
doGeneral(Access2D.Collectable<N,? super PhysicalStore<N>> matrix,
boolean eigenvaluesOnly) |
protected boolean |
doHermitian(Access2D.Collectable<N,? super PhysicalStore<N>> matrix,
boolean valuesOnly) |
protected FunctionSet<N> |
function() |
MatrixStore<N> |
getD()
The only requirements on [D] are that it should contain the eigenvalues and that [A][V] = [V][D].
|
N |
getDeterminant()
A matrix' determinant is the product of its eigenvalues.
|
protected double |
getDimensionalEpsilon() |
Array1D<ComplexNumber> |
getEigenvalues()
Even for real matrices the eigenvalues (and eigenvectors) are potentially complex numbers.
|
void |
getEigenvalues(double[] realParts,
Optional<double[]> imaginaryParts) |
MatrixStore<N> |
getInverse()
The output must be a "right inverse" and a "generalised inverse".
|
MatrixStore<N> |
getInverse(PhysicalStore<N> preallocated)
Implementiong this method is optional.
|
MatrixStore<N> |
getSolution(Access2D.Collectable<N,? super PhysicalStore<N>> rhs)
[A][X]=[B] or [this][return]=[rhs]
|
MatrixStore<N> |
getSolution(Access2D.Collectable<N,? super PhysicalStore<N>> rhs,
PhysicalStore<N> preallocated)
Implementiong this method is optional.
|
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(Access2D<?> original)
The output must be a "right inverse" and a "generalised inverse".
|
MatrixStore<N> |
invert(Access2D<?> original,
PhysicalStore<N> preallocated)
Exactly how (if at all) a specific implementation makes use of
preallocated is not
specified by this interface. |
protected boolean |
isAspectRatioNormal() |
boolean |
isComputed() |
boolean |
isHermitian()
If [A] is hermitian then [V][D][V]-1 becomes [Q][D][Q]H...
|
boolean |
isOrdered()
The eigenvalues in D (and the eigenvectors in V) are not necessarily ordered.
|
boolean |
isSolvable() |
protected BasicArray<N> |
makeArray(int length) |
protected MatrixStore<N> |
makeD() |
protected Array1D<ComplexNumber> |
makeEigenvalues() |
protected DecompositionStore<N> |
makeEye(int numberOfRows,
int numberOfColumns) |
protected Householder<N> |
makeHouseholder(int dimension) |
protected MatrixStore.LogicalBuilder<N> |
makeIdentity(int dimension) |
protected Rotation<N> |
makeRotation(int low,
int high,
double cos,
double sin) |
protected Rotation<N> |
makeRotation(int low,
int high,
N cos,
N sin) |
protected MatrixStore<N> |
makeV() |
protected DecompositionStore<N> |
makeZero(int numberOfRows,
int numberOfColumns) |
PhysicalStore<N> |
preallocate(Structure2D template)
Will create a PhysicalStore instance suitable for use with
InverterTask.invert(Access2D, PhysicalStore). |
PhysicalStore<N> |
preallocate(Structure2D templateBody,
Structure2D templateRHS)
Will create a PhysicalStore instance suitable for use with
SolverTask.solve(Access2D, Access2D, PhysicalStore). |
void |
reset()
Delete computed results, and resets attributes to default values
|
protected Scalar.Factory<N> |
scalar() |
MatrixStore<N> |
solve(Access2D<?> body,
Access2D<?> rhs)
[A][X]=[B] or [body][return]=[rhs]
|
MatrixStore<N> |
solve(Access2D<?> body,
Access2D<?> rhs,
PhysicalStore<N> preallocated)
Exactly how (if at all) a specific implementation makes use of
preallocated is not
specified by this interface. |
protected MatrixStore.LogicalBuilder<N> |
wrap(Access2D<?> source) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcompute, isSolvabledecompose, isComputed, reconstructpreallocatepreallocatecopyEigenvector, equals, getEigenpair, getEigenvector, getEigenvectors, make, make, reconstruct, reconstructprotected HermitianEvD(PhysicalStore.Factory<N,? extends DecompositionStore<N>> aFactory, org.ojalgo.matrix.decomposition.TridiagonalDecomposition<N> tridiagonal)
public final N getDeterminant()
MatrixDecomposition.DeterminantA matrix' determinant is the product of its eigenvalues.
getDeterminant in interface MatrixDecomposition.Determinant<N extends Number>public void getEigenvalues(double[] realParts,
Optional<double[]> imaginaryParts)
getEigenvalues in interface Eigenvalue<N extends Number>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
eigenvaluespublic final MatrixStore<N> getInverse()
MatrixDecomposition.SolvergetInverse in interface MatrixDecomposition.Solver<N extends Number>BasicMatrix.invert()public final MatrixStore<N> getInverse(PhysicalStore<N> preallocated)
MatrixDecomposition.SolverImplementiong this method is optional.
Exactly how a specific implementation makes use of preallocated is not specified by
this interface. It must be documented for each implementation.
Should produce the same results as calling MatrixDecomposition.Solver.getInverse().
getInverse in interface MatrixDecomposition.Solver<N extends Number>preallocated - Preallocated memory for the results, possibly some intermediate results. You
must assume this is modified, but you cannot assume it will contain the full/final/correct
solution.public final MatrixStore<N> getSolution(Access2D.Collectable<N,? super PhysicalStore<N>> rhs)
MatrixDecomposition.SolvergetSolution in interface MatrixDecomposition.Solver<N extends Number>public final MatrixStore<N> getSolution(Access2D.Collectable<N,? super PhysicalStore<N>> rhs, PhysicalStore<N> preallocated)
MatrixDecomposition.SolverImplementiong this method is optional.
Exactly how a specific implementation makes use of preallocated is not specified by
this interface. It must be documented for each implementation.
Should produce the same results as calling #getSolution(Collectable).
getSolution in interface MatrixDecomposition.Solver<N extends Number>rhs - The Right Hand Side, wont be modfiedpreallocated - Preallocated memory for the results, possibly some intermediate results. You
must assume this is modified, but you cannot assume it will contain the full/final/correct
solution.public final ComplexNumber getTrace()
EigenvaluegetTrace in interface Eigenvalue<N extends Number>public final MatrixStore<N> invert(Access2D<?> original) throws RecoverableCondition
InverterTaskinvert in interface InverterTask<N extends Number>RecoverableCondition - TODOBasicMatrix.invert()public final MatrixStore<N> invert(Access2D<?> original, PhysicalStore<N> preallocated) throws RecoverableCondition
InverterTask
Exactly how (if at all) a specific implementation makes use of preallocated is not
specified by this interface. It must be documented for each implementation.
Should produce the same results as calling InverterTask.invert(Access2D).
Use InverterTask.preallocate(Structure2D) to obtain a suitbale preallocated.
invert in interface InverterTask<N extends Number>preallocated - Preallocated memory for the results, possibly some intermediate results. You must
assume this is modified, but you cannot assume it will contain the full/final/correct solution.RecoverableCondition - TODOpublic final boolean isHermitian()
EigenvalueisHermitian in interface Eigenvalue<N extends Number>public boolean isOrdered()
EigenvalueisOrdered in interface Eigenvalue<N extends Number>isOrdered in interface MatrixDecomposition.Ordered<N extends Number>public PhysicalStore<N> preallocate(Structure2D template)
InverterTask
Will create a PhysicalStore instance suitable for use with
InverterTask.invert(Access2D, PhysicalStore).
When inverting a matrix (mxn) the preallocated memory/matrix will typically be nxm (and of course most of the time A is square).
preallocate in interface InverterTask<N extends Number>public PhysicalStore<N> preallocate(Structure2D templateBody, Structure2D templateRHS)
SolverTask
Will create a PhysicalStore instance suitable for use with
SolverTask.solve(Access2D, Access2D, PhysicalStore). The dimensions of the returned instance is not
specified by this interface - it is specified by the behaviour/requirements of each implementation.
When solving an equation system [A][X]=[B] ([mxn][nxb]=[mxb]) the preallocated memory/matrix will typically be either mxb or nxb.
preallocate in interface SolverTask<N extends Number>public void reset()
MatrixDecompositionreset in interface MatrixDecomposition<N extends Number>public MatrixStore<N> solve(Access2D<?> body, Access2D<?> rhs) throws RecoverableCondition
SolverTasksolve in interface SolverTask<N extends Number>RecoverableConditionpublic MatrixStore<N> solve(Access2D<?> body, Access2D<?> rhs, PhysicalStore<N> preallocated) throws RecoverableCondition
SolverTask
Exactly how (if at all) a specific implementation makes use of preallocated is not
specified by this interface. It must be documented for each implementation.
Should produce the same results as calling SolverTask.solve(Access2D, Access2D).
Use SolverTask.preallocate(Structure2D, Structure2D) to obtain a suitbale preallocated.
solve in interface SolverTask<N extends Number>rhs - The Right Hand Side, wont be modfiedpreallocated - Preallocated memory for the results, possibly some intermediate results. You must
assume this is modified, but you cannot assume it will contain the full/final/correct solution.RecoverableConditionprotected boolean checkSolvability()
protected final boolean doGeneral(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean eigenvaluesOnly)
protected final boolean doHermitian(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean valuesOnly)
protected double getDimensionalEpsilon()
protected MatrixStore<N> makeD()
protected Array1D<ComplexNumber> makeEigenvalues()
protected MatrixStore<N> makeV()
public N calculateDeterminant(Access2D<?> matrix)
calculateDeterminant in interface DeterminantTask<N extends Number>public final boolean checkAndCompute(MatrixStore<N> matrix)
MatrixDecomposition.HermitiancheckAndCompute in interface MatrixDecomposition.Hermitian<N extends Number>matrix - A matrix to check and then (maybe) decomposepublic boolean computeValuesOnly(Access2D.Collectable<N,? super PhysicalStore<N>> matrix)
computeValuesOnly in interface MatrixDecomposition.Values<N extends Number>matrix - The matrix to decomposeSolver#compute(Collectable) or #decompose(Collectable) if the
instance does not implement MatrixDecomposition.Solver.public final boolean decompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix)
decompose in interface MatrixDecomposition<N extends Number>matrix - A matrix to decomposepublic final MatrixStore<N> getD()
EigenvaluegetD in interface Eigenvalue<N extends Number>public final Array1D<ComplexNumber> getEigenvalues()
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.
Prior to v41 this array should always be ordered in descending order - largest (modulus) first. As of
v41 the values should be in the same order as the matrices "V" and "D", and if that is ordered or not
is indicated by the Eigenvalue.isOrdered() method.
getEigenvalues in interface Eigenvalue<N extends Number>public final MatrixStore<N> getV()
EigenvaluegetV in interface Eigenvalue<N extends Number>protected final AggregatorSet<N> aggregator()
protected final DecompositionStore<N> allocate(long numberOfRows, long numberOfColumns)
protected final MatrixStore<N> collect(Access2D.Collectable<N,? super DecompositionStore<N>> source)
protected final DecompositionStore<N> copy(Access2D<?> source)
protected final FunctionSet<N> function()
protected final BasicArray<N> makeArray(int length)
protected final DecompositionStore<N> makeEye(int numberOfRows, int numberOfColumns)
protected final Householder<N> makeHouseholder(int dimension)
protected final MatrixStore.LogicalBuilder<N> makeIdentity(int dimension)
protected final Rotation<N> makeRotation(int low, int high, double cos, double sin)
protected final Rotation<N> makeRotation(int low, int high, N cos, N sin)
protected final DecompositionStore<N> makeZero(int numberOfRows, int numberOfColumns)
protected final Scalar.Factory<N> scalar()
protected final MatrixStore.LogicalBuilder<N> wrap(Access2D<?> source)
public final boolean isComputed()
isComputed in interface MatrixDecomposition<N extends Number>MatrixDecomposition.decompose(Access2D.Collectable)public final boolean isSolvable()
protected final boolean aspectRatioNormal(boolean aspectRatioNormal)
protected final boolean computed(boolean computed)
protected final boolean isAspectRatioNormal()
Copyright © 2018 Optimatika. All rights reserved.