Class RealExactSolver
- Type Parameters:
T- The type of the coefficient matrix in the linear system.U- The type of vector in the linear system.
- All Implemented Interfaces:
LinearMatrixSolver<Matrix,,Vector> LinearSolver<Matrix>
Solves a well determined system of equations \( Ax = b \) or \( AX = B \)
in an exact sense by using a
LU decomposition
where \( A \), \( B \), and \( X \)
are matrices, and \( x \) and \( b \) are vectors.
If the system is not well determined, i.e. \( A \) is not square or not full rank, then use a
least-squares solver.
Usage:
A single system may be solved by calling either ExactSolver.solve(MatrixMixin, VectorMixin) or
ExactSolver.solve(MatrixMixin, VectorMixin).
Instances of this solver may also be used to efficiently solve many systems of the form \( Ax = b \) or \( AX = B \) for the same coefficient matrix \( A \) but numerous constant vectors/matrices \( b \) or \( B \). To do this, the workflow would be as follows:
- Create an instance of
RealExactSolver. - Call
decompse(A)once on the coefficient matrix \( A \). - Call
solve(b)orsolve(B)as many times as needed to solve each system for with the various \( b \) vectors and/or \( B \) matrices.
decompse(A)
will
override the coefficient matrix set that call:
Specialized solvers are provided for inversion using ExactSolver.solveIdentity(MatrixMixin). This should be preferred
over calling on of the other solve methods and providing an identity matrix explicitly.
-
Field Summary
Fields inherited from class org.flag4j.linalg.solvers.exact.ExactSolver
backSolver, forwardSolver, lu, LU, rowPermute -
Constructor Summary
ConstructorsConstructorDescriptionConstructs an exact LU solver where the coefficient matrix is real dense. -
Method Summary
Methods inherited from class org.flag4j.linalg.solvers.exact.ExactSolver
decompose, solve, solve, solve, solve, solveIdentity
-
Constructor Details
-
RealExactSolver
public RealExactSolver()Constructs an exact LU solver where the coefficient matrix is real dense.
-
-
Method Details
-
permuteRows
Permute the rows of a vector using the row permutation matrix from the LU decomposition.- Specified by:
permuteRowsin classExactSolver<Matrix,Vector> - Parameters:
b- Vector to permute the rows of.- Returns:
- A vector which is the result of applying the row permutation from the LU decomposition
to the vector
b.
-
permuteRows
Permute the rows of a matrix using the row permutation matrix from the LU decomposition.- Specified by:
permuteRowsin classExactSolver<Matrix,Vector> - Parameters:
B- matrix to permute the rows of.- Returns:
- A matrix which is the result of applying the row permutation from the LU decomposition
to the matrix
B.
-