Class RawLU
- All Implemented Interfaces:
LDU<Double>
,LU<Double>
,MatrixDecomposition<Double>
,MatrixDecomposition.Determinant<Double>
,MatrixDecomposition.Ordered<Double>
,MatrixDecomposition.Pivoting<Double>
,MatrixDecomposition.RankRevealing<Double>
,MatrixDecomposition.Solver<Double>
,Provider2D
,Provider2D.Determinant<Double>
,Provider2D.Inverse<Optional<MatrixStore<Double>>>
,Provider2D.Rank
,Provider2D.Solution<Optional<MatrixStore<Double>>>
,DeterminantTask<Double>
,InverterTask<Double>
,MatrixTask<Double>
,SolverTask<Double>
,InvertibleFactor<Double>
,Structure1D
,Structure2D
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ojalgo.matrix.transformation.InvertibleFactor
InvertibleFactor.IdentityFactor<N extends Comparable<N>>
Nested classes/interfaces inherited from interface org.ojalgo.matrix.decomposition.LU
LU.Factory<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
FieldsFields inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
TYPICAL
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
btran
(PhysicalStore<Double> arg) Backwards-transformationvoid
btran
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> lhs, PhysicalStore<Double> solution) calculateDeterminant
(Access2D<?> matrix) protected boolean
int
countSignificant
(double threshold) boolean
decompose
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> matrix) boolean
decomposeWithoutPivoting
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> matrix) The normalMatrixDecomposition.decompose(Access2D.Collectable)
method must handle cases where pivoting is necessary.private boolean
doDecompose
(double[][] data, boolean pivoting) private MatrixStore
<Double> doGetInverse
(PhysicalStore<Double> preallocated) private MatrixStore
<Double> doSolve
(PhysicalStore<Double> preallocated) void
ftran
(PhysicalStore<Double> arg) Forward-transformationA matrix' determinant is the product of its eigenvalues.The output must be a "right inverse" and a "generalised inverse".getInverse
(PhysicalStore<Double> preallocated) Implementing this method is optional.getL()
int[]
double
int[]
getSolution
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> rhs) [A][X]=[B] or [this][return]=[rhs]getSolution
(Access2D.Collectable<Double, ? super PhysicalStore<Double>> rhs, PhysicalStore<Double> preallocated) Implementing this method is optional.getU()
http://en.wikipedia.org/wiki/Row_echelon_form
This is the same as [D][U].invert
(Access2D<?> original, PhysicalStore<Double> preallocated) Exactly how (if at all) a specific implementation makes use ofpreallocated
is not specified by this interface.boolean
boolean
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.preallocate
(Structure2D template) Will create a PhysicalStore instance suitable for use withInverterTask.invert(Access2D, PhysicalStore)
.preallocate
(Structure2D templateBody, Structure2D templateRHS) Will create a PhysicalStore instance suitable for use withSolverTask.solve(Access2D, Access2D, PhysicalStore)
.solve
(Access2D<?> body, Access2D<?> rhs, PhysicalStore<Double> preallocated) Exactly how (if at all) a specific implementation makes use ofpreallocated
is not specified by this interface.Methods inherited from class org.ojalgo.matrix.decomposition.RawDecomposition
allocate, checkSymmetry, collect, function, getColDim, getInternalData, getInternalStore, getRowDim, make, makeDiagonal, newRawStore, reset, scalar, wrap, wrap
Methods inherited from class org.ojalgo.matrix.decomposition.AbstractDecomposition
computed, countColumns, countRows, getDimensionalEpsilon, isAspectRatioNormal, isComputed, reset
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
invert, preallocate
Methods inherited from interface org.ojalgo.matrix.decomposition.LU
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.RankRevealing
getRank, isFullRank
Methods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Solver
compute, ftran, invert, 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 Details
-
myPivot
-
-
Constructor Details
-
RawLU
RawLU()Not recommended to use this constructor directly. Consider using the static factory methodinvalid reference
org.ojalgo.matrix.decomposition.LU#make(Access2D)
-
-
Method Details
-
btran
public void btran(Access2D.Collectable<Double, ? super PhysicalStore<Double>> lhs, PhysicalStore<Double> solution) - Specified by:
btran
in interfaceInvertibleFactor<Double>
-
btran
Description copied from interface:InvertibleFactor
Backwards-transformationSolve [x]T[A] = [b]T (equivalent to [A]T[x] = [b]) by transforming [b] into [x] in-place.
- Specified by:
btran
in interfaceInvertibleFactor<Double>
- Parameters:
arg
- [b] transformed into [x]
-
calculateDeterminant
- Specified by:
calculateDeterminant
in interfaceDeterminantTask<Double>
-
countSignificant
public int countSignificant(double threshold) - Specified by:
countSignificant
in interfaceMatrixDecomposition.RankRevealing<Double>
- Parameters:
threshold
- Significance limit- Returns:
- The number of elements in the diagonal matrix that are greater than the threshold
-
decompose
- Specified by:
decompose
in interfaceMatrixDecomposition<Double>
- Parameters:
matrix
- A matrix to decompose- Returns:
- true if decomposition suceeded; false if not
-
decomposeWithoutPivoting
public boolean decomposeWithoutPivoting(Access2D.Collectable<Double, ? super PhysicalStore<Double>> matrix) Description copied from interface:MatrixDecomposition.Pivoting
The 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:
decomposeWithoutPivoting
in interfaceMatrixDecomposition.Pivoting<Double>
-
ftran
Description copied from interface:InvertibleFactor
Forward-transformationSolve [A][x] = [b] by transforming [b] into [x] in-place.
- Specified by:
ftran
in interfaceInvertibleFactor<Double>
- Specified by:
ftran
in interfaceMatrixDecomposition.Solver<Double>
- Parameters:
arg
- [b] transformed into [x]
-
getDeterminant
Description copied from interface:MatrixDecomposition.Determinant
A matrix' determinant is the product of its eigenvalues.
- Specified by:
getDeterminant
in interfaceMatrixDecomposition.Determinant<Double>
- Specified by:
getDeterminant
in interfaceProvider2D.Determinant<Double>
- Returns:
- The matrix' determinant
-
getInverse
Description copied from interface:MatrixDecomposition.Solver
The output must be a "right inverse" and a "generalised inverse".- Specified by:
getInverse
in interfaceMatrixDecomposition.Solver<Double>
-
getInverse
Description copied from interface:MatrixDecomposition.Solver
Implementing 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()
.- Specified by:
getInverse
in interfaceMatrixDecomposition.Solver<Double>
- 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. UseInverterTask.preallocate(int, int)
orInverterTask.preallocate(Structure2D)
to get a suitable instance.- Returns:
- The inverse, this is where you get the solution
-
getL
-
getPivotOrder
public int[] getPivotOrder()- Specified by:
getPivotOrder
in interfaceMatrixDecomposition.Pivoting<Double>
- Returns:
- The pivot (row and/or columnn) order
-
getRankThreshold
public double getRankThreshold()- Specified by:
getRankThreshold
in interfaceMatrixDecomposition.RankRevealing<Double>
-
getReversePivotOrder
public int[] getReversePivotOrder()- Specified by:
getReversePivotOrder
in interfaceMatrixDecomposition.Pivoting<Double>
-
getSolution
public MatrixStore<Double> getSolution(Access2D.Collectable<Double, ? super PhysicalStore<Double>> rhs) Description copied from interface:MatrixDecomposition.Solver
[A][X]=[B] or [this][return]=[rhs]- Specified by:
getSolution
in interfaceMatrixDecomposition.Solver<Double>
-
getSolution
public MatrixStore<Double> getSolution(Access2D.Collectable<Double, ? super PhysicalStore<Double>> rhs, PhysicalStore<Double> preallocated) Description copied from interface:MatrixDecomposition.Solver
Implementing 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.getSolution(Collectable)
.- Specified by:
getSolution
in interfaceMatrixDecomposition.Solver<Double>
- 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
-
getU
Description copied from interface:LU
http://en.wikipedia.org/wiki/Row_echelon_form
This is the same as [D][U]. Together with the pivotOrder and [L] this constitutes an alternative, more compact, way to express the decomposition. -
invert
public MatrixStore<Double> invert(Access2D<?> original, PhysicalStore<Double> preallocated) throws RecoverableCondition Description copied from interface: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 suitbalepreallocated
.- Specified by:
invert
in interfaceInverterTask<Double>
- 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/ /correct solution.- Returns:
- The inverse
- Throws:
RecoverableCondition
- TODO
-
isPivoted
public boolean isPivoted()- Specified by:
isPivoted
in interfaceMatrixDecomposition.Pivoting<Double>
- Returns:
- true if any pivoting was actually done
-
isSolvable
public boolean isSolvable()Description copied from interface:MatrixDecomposition.Solver
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. It's that in combination with the specific decomposition algorithm's capabilities.- Specified by:
isSolvable
in interfaceMatrixDecomposition.Solver<Double>
- Overrides:
isSolvable
in classAbstractDecomposition<Double>
- 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
Description copied from interface: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).
- Specified by:
preallocate
in interfaceInverterTask<Double>
-
preallocate
Description copied from interface: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.
- Specified by:
preallocate
in interfaceSolverTask<Double>
-
solve
public MatrixStore<Double> solve(Access2D<?> body, Access2D<?> rhs, PhysicalStore<Double> preallocated) throws RecoverableCondition Description copied from interface: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 suitbalepreallocated
.- Specified by:
solve
in interfaceSolverTask<Double>
- 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/ /correct solution.- Returns:
- The solution
- Throws:
RecoverableCondition
-
doDecompose
private boolean doDecompose(double[][] data, boolean pivoting) -
doGetInverse
-
doSolve
-
checkSolvability
protected boolean checkSolvability()- Overrides:
checkSolvability
in classAbstractDecomposition<Double>
-