Interface LinearSolver<S extends Matrix,D extends Matrix>

All Known Subinterfaces:
AdjustableLinearSolver_DDRM, AdjustableLinearSolver_FDRM, LinearSolverDense<T>, LinearSolverSparse<S,D>
All Known Implementing Classes:
AdjLinearSolverQr_DDRM, AdjLinearSolverQr_FDRM, BaseLinearSolverQrp_DDRM, BaseLinearSolverQrp_FDRM, CholeskyOuterSolver_DDRB, CholeskyOuterSolver_FDRB, CholeskyOuterSolver_MT_DDRB, CholeskyOuterSolver_MT_FDRB, LinearSolver_DDRB_to_DDRM, LinearSolver_FDRB_to_FDRM, LinearSolverAbstract_CDRM, LinearSolverAbstract_DDRM, LinearSolverAbstract_FDRM, LinearSolverAbstract_ZDRM, LinearSolverChol_CDRM, LinearSolverChol_DDRB, LinearSolverChol_DDRM, LinearSolverChol_FDRB, LinearSolverChol_FDRM, LinearSolverChol_ZDRM, LinearSolverCholesky_DSCC, LinearSolverCholesky_FSCC, LinearSolverCholLDL_DDRM, LinearSolverCholLDL_FDRM, LinearSolverLu_CDRM, LinearSolverLu_DDRM, LinearSolverLu_DSCC, LinearSolverLu_FDRM, LinearSolverLu_FSCC, LinearSolverLu_ZDRM, LinearSolverLuBase_CDRM, LinearSolverLuBase_DDRM, LinearSolverLuBase_FDRM, LinearSolverLuBase_ZDRM, LinearSolverLuKJI_DDRM, LinearSolverLuKJI_FDRM, LinearSolverQr_CDRM, LinearSolverQr_DDRM, LinearSolverQr_FDRM, LinearSolverQr_ZDRM, LinearSolverQrBlock64_DDRM, LinearSolverQrBlock64_FDRM, LinearSolverQrHouse_CDRM, LinearSolverQrHouse_DDRM, LinearSolverQrHouse_FDRM, LinearSolverQrHouse_ZDRM, LinearSolverQrHouseCol_CDRM, LinearSolverQrHouseCol_DDRM, LinearSolverQrHouseCol_FDRM, LinearSolverQrHouseCol_MT_DDRM, LinearSolverQrHouseCol_MT_FDRM, LinearSolverQrHouseCol_ZDRM, LinearSolverQrHouseTran_CDRM, LinearSolverQrHouseTran_DDRM, LinearSolverQrHouseTran_FDRM, LinearSolverQrHouseTran_ZDRM, LinearSolverQrLeftLooking_DSCC, LinearSolverQrLeftLooking_FSCC, LinearSolverQrpHouseCol_DDRM, LinearSolverQrpHouseCol_FDRM, LinearSolverSafe, LinearSolverSparseSafe, LinearSolverToSparse, LinearSolverUnrolled_DDRM, LinearSolverUnrolled_FDRM, QrHouseHolderSolver_DDRB, QrHouseHolderSolver_FDRB, QrHouseHolderSolver_MT_DDRB, QrHouseHolderSolver_MT_FDRB, SolvePseudoInverseQrp_DDRM, SolvePseudoInverseQrp_FDRM, SolvePseudoInverseSvd_DDRM, SolvePseudoInverseSvd_FDRM

public interface LinearSolver<S extends Matrix,D extends Matrix>

Base class for Linear Solvers.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    <Decomposition extends DecompositionInterface>
    Decomposition
    If a decomposition class was used internally then this will return that class.
    boolean
    Returns true if the passed in matrix to setA(Matrix) is modified.
    boolean
    Returns true if the passed in 'B' matrix to solve(Matrix, Matrix) is modified.
    double
    Returns a very quick to compute measure of how singular the system is.
    boolean
    setA(S A)
    Specifies the A matrix in the linear equation.
    void
    solve(D B, D X)
    Solves for X in the linear system, A*X=B.
  • Method Details

    • setA

      boolean setA(S A)

      Specifies the A matrix in the linear equation. A reference might be saved and it might also be modified depending on the implementation. If it is modified then modifiesA() will return true.

      If this value returns true that does not guarantee a valid solution was generated. This is because some decompositions don't detect singular matrices.

      Parameters:
      A - The 'A' matrix in the linear equation. Might be modified or save the reference.
      Returns:
      true if it can be processed.
    • quality

      double quality()

      Returns a very quick to compute measure of how singular the system is. This measure will be invariant to the scale of the matrix and always be positive, with larger values indicating it is less singular. If not supported by the solver then the runtime exception IllegalArgumentException is thrown. This is NOT the matrix's condition.

      How this function is implemented is not specified. One possible implementation is the following: In many decompositions a triangular matrix is extracted. The determinant of a triangular matrix is easily computed and once normalized to be scale invariant and its absolute value taken it will provide functionality described above.

      Returns:
      The quality of the linear system.
    • solve

      void solve(D B, D X)

      Solves for X in the linear system, A*X=B.

      In some implementations 'B' and 'X' can be the same instance of a variable. Call modifiesB() to determine if 'B' is modified.

      Parameters:
      B - A matrix ℜ m × p. Might be modified.
      X - A matrix ℜ n × p, where the solution is written to. Modified.
    • modifiesA

      boolean modifiesA()
      Returns true if the passed in matrix to setA(Matrix) is modified.
      Returns:
      true if A is modified in setA().
    • modifiesB

      boolean modifiesB()
      Returns true if the passed in 'B' matrix to solve(Matrix, Matrix) is modified.
      Returns:
      true if B is modified in solve(B,X).
    • getDecomposition

      <Decomposition extends DecompositionInterface> Decomposition getDecomposition()
      If a decomposition class was used internally then this will return that class. Most linear solvers decompose the input matrix into a more simplistic form. However some solutions do not require decomposition, e.g. inverse by minor.
      Type Parameters:
      Decomposition - Decomposition type
      Returns:
      Internal decomposition class. If there is none then null.