Class DenseLDL<N extends java.lang.Comparable<N>>
- java.lang.Object
-
- org.ojalgo.matrix.decomposition.AbstractDecomposition<N,DecompositionStore<N>>
-
- org.ojalgo.matrix.decomposition.InPlaceDecomposition<N>
-
- org.ojalgo.matrix.decomposition.DenseLDL<N>
-
- All Implemented Interfaces:
LDL<N>,LDU<N>,MatrixDecomposition<N>,MatrixDecomposition.Determinant<N>,MatrixDecomposition.Hermitian<N>,MatrixDecomposition.Ordered<N>,MatrixDecomposition.Pivoting<N>,MatrixDecomposition.RankRevealing<N>,MatrixDecomposition.Solver<N>,Provider2D,Provider2D.Determinant<N>,Provider2D.Inverse<java.util.Optional<MatrixStore<N>>>,Provider2D.Rank,Provider2D.Solution<java.util.Optional<MatrixStore<N>>>,DeterminantTask<N>,InverterTask<N>,MatrixTask<N>,SolverTask<N>,InvertibleFactor<N>,Structure1D,Structure2D
- Direct Known Subclasses:
DenseLDL.C128,DenseLDL.H256,DenseLDL.Q128,DenseLDL.R064,DenseLDL.R128
abstract class DenseLDL<N extends java.lang.Comparable<N>> extends InPlaceDecomposition<N> implements LDL<N>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classDenseLDL.C128(package private) static classDenseLDL.H256(package private) static classDenseLDL.Q128(package private) static classDenseLDL.R064(package private) static classDenseLDL.R128-
Nested classes/interfaces inherited from interface org.ojalgo.matrix.transformation.InvertibleFactor
InvertibleFactor.IdentityFactor<N extends java.lang.Comparable<N>>
-
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.LDL
LDL.Factory<N extends java.lang.Comparable<N>>, LDL.ModifiedFactory<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.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>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedDenseLDL(PhysicalStore.Factory<N,? extends DecompositionStore<N>> factory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbtran(double[] arg)voidbtran(PhysicalStore<N> arg)Backwards-transformationNcalculateDeterminant(Access2D<?> matrix)protected booleancheckSolvability()intcountSignificant(double threshold)booleandecompose(Access2D.Collectable<N,? super TransformableRegion<N>> matrix)booleandecomposeWithoutPivoting(Access2D.Collectable<N,? super TransformableRegion<N>> matrix)The normalMatrixDecomposition.decompose(Access2D.Collectable)method must handle cases where pivoting is necessary.private booleandoDecompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean pivoting)voidftran(double[] arg)voidftran(PhysicalStore<N> arg)Forward-transformationMatrixStore<N>getD()NgetDeterminant()A matrix' determinant is the product of its eigenvalues.MatrixStore<N>getInverse(PhysicalStore<N> preallocated)Implementing this method is optional.MatrixStore<N>getL()Must implement eitherLDL.getL()orLDL.getR().int[]getPivotOrder()doublegetRankThreshold()int[]getReversePivotOrder()MatrixStore<N>getSolution(Access2D.Collectable<N,? super PhysicalStore<N>> rhs, PhysicalStore<N> preallocated)Implementing this method is optional.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 ofpreallocatedis not specified by this interface.booleanisPivoted()booleanisSolvable()Please note that producing a pseudoinverse and/or a least squares solution is ok! The return value, of this method, is not an indication of if the decomposed matrix is square, has full rank, is postive definite or whatever.PhysicalStore<N>preallocate(int nbEquations, int nbVariables, int nbSolutions)(package private) voidsetThreshold(N threshold)MatrixStore<N>solve(Access2D<?> body, Access2D<?> rhs, PhysicalStore<N> preallocated)Exactly how (if at all) a specific implementation makes use ofpreallocatedis not specified by this interface.-
Methods inherited from class org.ojalgo.matrix.decomposition.InPlaceDecomposition
getColDim, getInPlace, getInverse, getRowDim, setInPlace
-
Methods inherited from class org.ojalgo.matrix.decomposition.AbstractDecomposition
aggregator, applyPivotOrder, applyReverseOrder, collect, computed, copyColumn, copyRow, function, getDimensionalEpsilon, isAspectRatioNormal, isComputed, makeArray, makeDiagonal, makeEye, makeHouseholder, makeIdentity, makeRotation, makeRotation, makeZero, makeZero, reset, 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.task.InverterTask
preallocate
-
Methods inherited from interface org.ojalgo.matrix.decomposition.LDL
getR, reconstruct
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
isComputed, reset
-
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.matrix.decomposition.MatrixDecomposition.RankRevealing
getRank, isFullRank
-
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Solver
compute, getInverse, getSolution, invert, preallocate, solve, toInverseProvider, toSolutionProvider
-
Methods inherited from interface org.ojalgo.matrix.task.SolverTask
preallocate, solve
-
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
-
myPivot
private final Pivot myPivot
-
myThreshold
private double myThreshold
-
-
Constructor Detail
-
DenseLDL
protected DenseLDL(PhysicalStore.Factory<N,? extends DecompositionStore<N>> factory)
-
-
Method Detail
-
btran
public void btran(double[] arg)
- Specified by:
btranin interfaceInvertibleFactor<N extends java.lang.Comparable<N>>- See Also:
InvertibleFactor.IdentityFactor.btran(PhysicalStore)
-
btran
public void btran(PhysicalStore<N> arg)
Description copied from interface:InvertibleFactorBackwards-transformationSolve [x]T[A] = [b]T (equivalent to [A]T[x] = [b]) by transforming [b] into [x] in-place.
- Specified by:
btranin interfaceInvertibleFactor<N extends java.lang.Comparable<N>>- Parameters:
arg- [b] transformed into [x]
-
calculateDeterminant
public N calculateDeterminant(Access2D<?> matrix)
- Specified by:
calculateDeterminantin interfaceDeterminantTask<N extends java.lang.Comparable<N>>
-
countSignificant
public int countSignificant(double threshold)
- Specified by:
countSignificantin interfaceMatrixDecomposition.RankRevealing<N extends java.lang.Comparable<N>>- Parameters:
threshold- Significance limit- Returns:
- The number of elements in the diagonal matrix that are greater than the threshold
-
decompose
public boolean decompose(Access2D.Collectable<N,? super TransformableRegion<N>> matrix)
- Specified by:
decomposein interfaceMatrixDecomposition<N extends java.lang.Comparable<N>>- Parameters:
matrix- A matrix to decompose- Returns:
- true if decomposition suceeded; false if not
-
decomposeWithoutPivoting
public boolean decomposeWithoutPivoting(Access2D.Collectable<N,? super TransformableRegion<N>> matrix)
Description copied from interface:MatrixDecomposition.PivotingThe normalMatrixDecomposition.decompose(Access2D.Collectable)method must handle cases where pivoting is necessary. If you know that pivoting is not needed you may call this method instead - it may be faster. Implementing this method, to actually decompose without pivoting, is optional. The default implementation simply callsMatrixDecomposition.decompose(Access2D.Collectable).- Specified by:
decomposeWithoutPivotingin interfaceMatrixDecomposition.Pivoting<N extends java.lang.Comparable<N>>
-
ftran
public void ftran(double[] arg)
- Specified by:
ftranin interfaceInvertibleFactor<N extends java.lang.Comparable<N>>- See Also:
InvertibleFactor.IdentityFactor.ftran(PhysicalStore)
-
ftran
public void ftran(PhysicalStore<N> arg)
Description copied from interface:InvertibleFactorForward-transformationSolve [A][x] = [b] by transforming [b] into [x] in-place.
- Specified by:
ftranin interfaceInvertibleFactor<N extends java.lang.Comparable<N>>- Parameters:
arg- [b] transformed into [x]
-
getD
public MatrixStore<N> getD()
-
getDeterminant
public N getDeterminant()
Description copied from interface:MatrixDecomposition.DeterminantA matrix' determinant is the product of its eigenvalues.
- Specified by:
getDeterminantin interfaceMatrixDecomposition.Determinant<N extends java.lang.Comparable<N>>- Specified by:
getDeterminantin interfaceProvider2D.Determinant<N extends java.lang.Comparable<N>>- Returns:
- The matrix' determinant
-
getInverse
public MatrixStore<N> getInverse(PhysicalStore<N> preallocated)
Description copied from interface:MatrixDecomposition.SolverImplementing this method is optional.
Exactly how a specific implementation makes use of
preallocatedis not specified by this interface. It must be documented for each implementation.Should produce the same results as calling
MatrixDecomposition.Solver.getInverse().- Specified by:
getInversein interfaceMatrixDecomposition.Solver<N extends java.lang.Comparable<N>>- Overrides:
getInversein classInPlaceDecomposition<N extends java.lang.Comparable<N>>- Parameters:
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. UseMatrixDecomposition.Solver.preallocate(int, int)orInverterTask.preallocate(Structure2D)to get a suitable instance.- Returns:
- The inverse, this is where you get the solution
-
getL
public MatrixStore<N> getL()
Description copied from interface:LDLMust implement eitherLDL.getL()orLDL.getR().
-
getPivotOrder
public int[] getPivotOrder()
- Specified by:
getPivotOrderin interfaceMatrixDecomposition.Pivoting<N extends java.lang.Comparable<N>>- Returns:
- The pivot (row and/or columnn) order
-
getRankThreshold
public double getRankThreshold()
- Specified by:
getRankThresholdin interfaceMatrixDecomposition.RankRevealing<N extends java.lang.Comparable<N>>
-
getReversePivotOrder
public int[] getReversePivotOrder()
- Specified by:
getReversePivotOrderin interfaceMatrixDecomposition.Pivoting<N extends java.lang.Comparable<N>>
-
getSolution
public MatrixStore<N> getSolution(Access2D.Collectable<N,? super PhysicalStore<N>> rhs, PhysicalStore<N> preallocated)
Description copied from interface:MatrixDecomposition.SolverImplementing this method is optional.
Exactly how a specific implementation makes use of
preallocatedis not specified by this interface. It must be documented for each implementation.Should produce the same results as calling
MatrixDecomposition.Solver.getSolution(Collectable).- Specified by:
getSolutionin interfaceMatrixDecomposition.Solver<N extends java.lang.Comparable<N>>- Parameters:
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. UseSolverTask.preallocate(int, int, int)orSolverTask.preallocate(Structure2D, Structure2D)to get a suitable instance.- Returns:
- The solution
-
invert
public MatrixStore<N> invert(Access2D<?> original) throws RecoverableCondition
Description copied from interface:InverterTaskThe output must be a "right inverse" and a "generalised inverse".- Specified by:
invertin interfaceInverterTask<N extends java.lang.Comparable<N>>- Throws:
RecoverableCondition
-
invert
public MatrixStore<N> invert(Access2D<?> original, PhysicalStore<N> preallocated) throws RecoverableCondition
Description copied from interface:InverterTaskExactly how (if at all) a specific implementation makes use of
preallocatedis 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 suitbalepreallocated.- Specified by:
invertin interfaceInverterTask<N extends java.lang.Comparable<N>>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.- Returns:
- The inverse
- Throws:
RecoverableCondition- TODO
-
isPivoted
public boolean isPivoted()
- Specified by:
isPivotedin interfaceMatrixDecomposition.Pivoting<N extends java.lang.Comparable<N>>- Returns:
- true if any pivoting was actually done
-
isSolvable
public boolean isSolvable()
Description copied from interface:MatrixDecomposition.SolverPlease note that producing a pseudoinverse and/or a least squares solution is ok! The return value, of this method, is not an indication of if the decomposed matrix is square, has full rank, is postive definite or whatever. It's that in combination with the specific decomposition algorithm's capabilities.- Specified by:
isSolvablein interfaceMatrixDecomposition.Solver<N extends java.lang.Comparable<N>>- Overrides:
isSolvablein classAbstractDecomposition<N extends java.lang.Comparable<N>,DecompositionStore<N extends java.lang.Comparable<N>>>- Returns:
- true if this matrix decomposition is in a state to be able to deliver an inverse or an equation system solution (with some degree of numerical stability).
-
preallocate
public PhysicalStore<N> preallocate(int nbEquations, int nbVariables, int nbSolutions)
- Specified by:
preallocatein interfaceSolverTask<N extends java.lang.Comparable<N>>
-
solve
public MatrixStore<N> solve(Access2D<?> body, Access2D<?> rhs, PhysicalStore<N> preallocated) throws RecoverableCondition
Description copied from interface:SolverTaskExactly how (if at all) a specific implementation makes use of
preallocatedis 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 suitbalepreallocated.- Specified by:
solvein interfaceSolverTask<N extends java.lang.Comparable<N>>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/ /correct solution.- Returns:
- The solution
- Throws:
RecoverableCondition
-
doDecompose
private boolean doDecompose(Access2D.Collectable<N,? super PhysicalStore<N>> matrix, boolean pivoting)
-
checkSolvability
protected boolean checkSolvability()
- Overrides:
checkSolvabilityin classAbstractDecomposition<N extends java.lang.Comparable<N>,DecompositionStore<N extends java.lang.Comparable<N>>>
-
setThreshold
void setThreshold(N threshold)
-
-