Class BiconjugateGradientSolver
- java.lang.Object
-
- dev.nm.algebra.linear.matrix.doubles.matrixtype.sparse.solver.iterative.nonstationary.BiconjugateGradientSolver
-
- All Implemented Interfaces:
IterativeLinearSystemSolver
public class BiconjugateGradientSolver extends Object implements IterativeLinearSystemSolver
The Biconjugate Gradient method (BiCG) is useful for solving non-symmetric n-by-n linear systems. It generates two CG-like sequences of vectors, one based on a system with the original coefficient matrix A, and one on At. They are made mutually orthogonal, or "bi-orthogonal". This method is useful when the matrix is non-symmetric and nonsingular. However, convergence may be irregular, and there is a possibility that the method will break down. BiCG , like CG, uses limited storage. It requires a multiplication with the coefficient matrix and with its transpose at each iteration. Only left preconditioning is supported in this implementation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.algebra.linear.matrix.doubles.matrixtype.sparse.solver.iterative.IterativeLinearSystemSolver
IterativeLinearSystemSolver.Solution
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_RESIDUAL_REFRESH_RATEThe algorithm recomputes the residual as b - Axi once per this number of iterations
-
Constructor Summary
Constructors Constructor Description BiconjugateGradientSolver(int maxIteration, Tolerance tolerance)Construct a Biconjugate Gradient (BiCG) solver.BiconjugateGradientSolver(PreconditionerFactory leftPreconditionerFactory, int residualRefreshRate, int maxIteration, Tolerance tolerance)Construct a Biconjugate Gradient (BiCG) solver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IterativeLinearSystemSolver.Solutionsolve(LSProblem problem)IterativeLinearSystemSolver.Solutionsolve(LSProblem problem, IterationMonitor<Vector> monitor)Solves iteratively Ax = b until the solution converges, i.e., the norm of residual (b - Ax) is less than or equal to the threshold.
-
-
-
Field Detail
-
DEFAULT_RESIDUAL_REFRESH_RATE
public static final int DEFAULT_RESIDUAL_REFRESH_RATE
The algorithm recomputes the residual as b - Axi once per this number of iterations- See Also:
- Constant Field Values
-
-
Constructor Detail
-
BiconjugateGradientSolver
public BiconjugateGradientSolver(PreconditionerFactory leftPreconditionerFactory, int residualRefreshRate, int maxIteration, Tolerance tolerance)
Construct a Biconjugate Gradient (BiCG) solver.- Parameters:
leftPreconditionerFactory- constructs a new left preconditionerresidualRefreshRate- the number of iterations before the next refreshmaxIteration- the maximum number of iterationstolerance- the convergence threshold
-
BiconjugateGradientSolver
public BiconjugateGradientSolver(int maxIteration, Tolerance tolerance)Construct a Biconjugate Gradient (BiCG) solver.- Parameters:
maxIteration- the maximum number of iterationstolerance- the convergence threshold
-
-
Method Detail
-
solve
public IterativeLinearSystemSolver.Solution solve(LSProblem problem) throws ConvergenceFailure
- Throws:
ConvergenceFailure
-
solve
public IterativeLinearSystemSolver.Solution solve(LSProblem problem, IterationMonitor<Vector> monitor) throws ConvergenceFailure
Description copied from interface:IterativeLinearSystemSolverSolves iterativelyAx = b
until the solution converges, i.e., the norm of residual (b - Ax) is less than or equal to the threshold.- Specified by:
solvein interfaceIterativeLinearSystemSolver- Parameters:
problem- a system of linear equationsmonitor- an iteration monitor- Returns:
- an (approximate) solution to the linear problem
- Throws:
ConvergenceFailure- if the algorithm fails to converge
-
-