- All Implemented Interfaces:
MatrixDecomposition<N>,MatrixDecomposition.Determinant<N>,MatrixDecomposition.EconomySize<N>,MatrixDecomposition.Ordered<N>,MatrixDecomposition.RankRevealing<N>,MatrixDecomposition.Solver<N>,MatrixDecomposition.Updatable<N>,QR<N>,Provider2D,Provider2D.Determinant<N>,Provider2D.Inverse<Optional<MatrixStore<N>>>,Provider2D.Rank,Provider2D.Solution<Optional<MatrixStore<N>>>,DeterminantTask<N>,InverterTask<N>,MatrixTask<N>,SolverTask<N>,InvertibleFactor<N>,Structure1D,Structure2D
- Direct Known Subclasses:
DenseQR.C128,DenseQR.H256,DenseQR.Q128,DenseQR.R064,DenseQR.R128
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final class(package private) static final class(package private) static final class(package private) static final class(package private) static final classNested 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.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.Updatable<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.matrix.decomposition.QR
QR.Factory<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.LoopCallbackNested 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 final booleanprivate intFields inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
TYPICAL -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDenseQR(PhysicalStore.Factory<N, ? extends DecompositionStore<N>> factory, boolean fullSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidbtran(double[] arg) voidbtran(PhysicalStore<N> arg) Backwards-transformationcalculateDeterminant(Access2D<?> matrix) protected booleanintcountSignificant(double threshold) booleandecompose(Access2D.Collectable<N, ? super TransformableRegion<N>> matrix) voidftran(double[] arg) A matrix' determinant is the product of its eigenvalues.getInverse(PhysicalStore<N> preallocated) Implementing this method is optional.protected DecompositionStore<N> getL()getQ()getR()doublegetSolution(Access2D.Collectable<N, ? super PhysicalStore<N>> rhs, PhysicalStore<N> preallocated) Solve [A]*[X]=[B] by first solving [Q]*[Y]=[B] and then [R]*[X]=[Y].The output must be a "right inverse" and a "generalised inverse".invert(Access2D<?> original, PhysicalStore<N> preallocated) Exactly how (if at all) a specific implementation makes use ofpreallocatedis not specified by this interface.booleanbooleanPlease 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(int nbEquations, int nbVariables, int nbSolutions) voidreset()Delete computed results, and resets attributes to default valuessolve(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, setInPlaceMethods 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, scalar, wrapMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ojalgo.matrix.task.InverterTask
preallocateMethods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition
isComputedMethods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Determinant
toDeterminantProviderMethods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.RankRevealing
getRank, isFullRankMethods inherited from interface org.ojalgo.matrix.decomposition.MatrixDecomposition.Solver
compute, getInverse, getSolution, invert, preallocate, solve, toInverseProvider, toSolutionProviderMethods inherited from interface org.ojalgo.matrix.decomposition.QR
ftran, isOrdered, reconstruct, updateColumnMethods inherited from interface org.ojalgo.matrix.task.SolverTask
preallocate, solveMethods 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
-
myFullSize
private final boolean myFullSize -
myNumberOfHouseholderTransformations
private int myNumberOfHouseholderTransformations
-
-
Constructor Details
-
DenseQR
protected DenseQR(PhysicalStore.Factory<N, ? extends DecompositionStore<N>> factory, boolean fullSize)
-
-
Method Details
-
btran
public void btran(double[] arg) - Specified by:
btranin interfaceInvertibleFactor<N extends Comparable<N>>- See Also:
-
btran
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 Comparable<N>>- Parameters:
arg- [b] transformed into [x]
-
calculateDeterminant
- Specified by:
calculateDeterminantin interfaceDeterminantTask<N extends Comparable<N>>
-
countSignificant
public int countSignificant(double threshold) - Specified by:
countSignificantin interfaceMatrixDecomposition.RankRevealing<N extends Comparable<N>>- Parameters:
threshold- Significance limit- Returns:
- The number of elements in the diagonal matrix that are greater than the threshold
-
decompose
- Specified by:
decomposein interfaceMatrixDecomposition<N extends Comparable<N>>- Parameters:
matrix- A matrix to decompose- Returns:
- true if decomposition suceeded; false if not
-
ftran
public void ftran(double[] arg) - Specified by:
ftranin interfaceInvertibleFactor<N extends Comparable<N>>- See Also:
-
getDeterminant
Description copied from interface:MatrixDecomposition.DeterminantA matrix' determinant is the product of its eigenvalues.
- Specified by:
getDeterminantin interfaceMatrixDecomposition.Determinant<N extends Comparable<N>>- Specified by:
getDeterminantin interfaceProvider2D.Determinant<N extends Comparable<N>>- Returns:
- The matrix' determinant
-
getInverse
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 Comparable<N>>- Overrides:
getInversein classInPlaceDecomposition<N extends 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
-
getQ
- Specified by:
getQin interfaceQR<N extends Comparable<N>>
-
getR
- Specified by:
getRin interfaceQR<N extends Comparable<N>>
-
getRankThreshold
public double getRankThreshold()- Specified by:
getRankThresholdin interfaceMatrixDecomposition.RankRevealing<N extends Comparable<N>>
-
getSolution
public MatrixStore<N> getSolution(Access2D.Collectable<N, ? super PhysicalStore<N>> rhs, PhysicalStore<N> preallocated) Solve [A]*[X]=[B] by first solving [Q]*[Y]=[B] and then [R]*[X]=[Y]. [X] minimises the 2-norm of [Q]*[R]*[X]-[B].- Specified by:
getSolutionin interfaceMatrixDecomposition.Solver<N extends Comparable<N>>- Parameters:
rhs- The right hand side [B]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. UseSolverTask.preallocate(int, int, int)orSolverTask.preallocate(Structure2D, Structure2D)to get a suitable instance.- Returns:
- [X] "preallocated" is used to form the results, but the solution is in the returned MatrixStore.
-
invert
Description copied from interface:InverterTaskThe output must be a "right inverse" and a "generalised inverse".- Specified by:
invertin interfaceInverterTask<N extends 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 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.- Returns:
- The inverse
- Throws:
RecoverableCondition- TODO
-
isFullSize
public boolean isFullSize()- Specified by:
isFullSizein interfaceMatrixDecomposition.EconomySize<N extends Comparable<N>>- Returns:
- True if it will generate a full sized decomposition.
-
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 Comparable<N>>- Overrides:
isSolvablein classAbstractDecomposition<N extends Comparable<N>,DecompositionStore<N extends 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
- Specified by:
preallocatein interfaceSolverTask<N extends Comparable<N>>
-
reset
public void reset()Description copied from interface:MatrixDecompositionDelete computed results, and resets attributes to default values- Specified by:
resetin interfaceMatrixDecomposition<N extends Comparable<N>>- Overrides:
resetin classAbstractDecomposition<N extends Comparable<N>,DecompositionStore<N extends 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 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/ /correct solution.- Returns:
- The solution
- Throws:
RecoverableCondition
-
checkSolvability
protected boolean checkSolvability()- Overrides:
checkSolvabilityin classAbstractDecomposition<N extends Comparable<N>,DecompositionStore<N extends Comparable<N>>>
-
getL
- Returns:
- L as in RT.
-