smile.math.matrix

• java.lang.Object

• ```public class BiconjugateGradient
extends java.lang.Object```
The biconjugate gradient method is an algorithm to solve systems of linear equations.
• ### Constructor Summary

Constructors
Constructor and Description
`BiconjugateGradient()`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`static Preconditioner` `Jacobi(DMatrix A)`
Returns a simple preconditioner matrix that is the trivial diagonal part of A in some cases.
`static double` ```solve(DMatrix A, double[] b, double[] x)```
Solves A * x = b by iterative biconjugate gradient method with Jacobi preconditioner matrix.
`static double` ```solve(DMatrix A, double[] b, double[] x, Preconditioner preconditioner, double tol, int itol, int maxIter)```
Solves A * x = b by iterative biconjugate gradient method.
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

`public BiconjugateGradient()`
• ### Method Detail

• #### Jacobi

`public static Preconditioner Jacobi(DMatrix A)`
Returns a simple preconditioner matrix that is the trivial diagonal part of A in some cases.
• #### solve

```public static double solve(DMatrix A,
double[] b,
double[] x)```
Solves A * x = b by iterative biconjugate gradient method with Jacobi preconditioner matrix.
Parameters:
`b` - the right hand side of linear equations.
`x` - on input, x should be set to an initial guess of the solution (or all zeros). On output, x is reset to the improved solution.
Returns:
the estimated error.
• #### solve

```public static double solve(DMatrix A,
double[] b,
double[] x,
Preconditioner preconditioner,
double tol,
int itol,
int maxIter)```
Solves A * x = b by iterative biconjugate gradient method.
Parameters:
`b` - the right hand side of linear equations.
`x` - on input, x should be set to an initial guess of the solution (or all zeros). On output, x is reset to the improved solution.
`preconditioner` - The preconditioner matrix.
`tol` - The desired convergence tolerance.
`itol` - Which convergence test is applied. If itol = 1, iteration stops when |Ax - b| / |b| is less than the parameter tolerance. If itol = 2, the stop criterion is that |A-1 (Ax - b)| / |A-1b| is less than tolerance. If tol = 3, |xk+1 - xk|2 is less than tolerance. The setting of tol = 4 is same as tol = 3 except that the L norm instead of L2.
`maxIter` - The maximum number of iterations.
Returns:
the estimated error.