|
|
◆ bicg1()
| def bicg1 |
( |
n |
, |
|
|
val |
, |
|
|
rowptr |
, |
|
|
colind |
, |
|
|
b |
, |
|
|
x |
, |
|
|
tol |
= 1.0e-10, |
|
|
maxiter |
= 500 |
|
) |
| |
Solution of linear system Ax = b using bi-conjugate gradient (BICG) method (Simple driver)
- Purpose
- This routine solves the linear system Ax = b using the bi-conjugate gradient (BICG) iterative method. Matrix A is represented in CSR format.
- Returns
- (info, iter, res)
info (int):
= 0: Successful exit.
= i < 0: The (-i)-th argument is invalid.
= 11: Maximum number of iterations exceeded.
= 12: Breakdown occurred.
iter (int):
Final number of iterations.
res (float):
Final residual norm norm(b - A*x).
- Parameters
-
| [in] | n | Dimension of the matrix. (n >= 0) (If n = 0, returns without computation) |
| [in] | val | Numpy ndarray (1-dimensional, float, nnz)
Values of nonzero elements of matrix A (where nnz is the number of nonzero elements). |
| [in] | rowptr | Numpy ndarray (1-dimensional, int32, n + 1)
Row pointers of matrix A. |
| [in] | colind | Numpy ndarray (1-dimensional, int32, nnz)
Column indices of matrix A (where nnz is the number of nonzero elements). |
| [in] | b | Numpy ndarray (1-dimensional, float, n)
Right hand side vector b. |
| [in,out] | x | Numpy ndarray (1-dimensional, float, n)
[in] Initial guess of solution.
[out] Obtained approximate solution. |
| [in] | tol | (Optional)
Tolerance for convergence test. (default = 1.0e-10)
Assumed to be converged if norm(b - A*x) <= tol*norm(b).
If tol < eps (machine epsilon), tol = eps is assumed. |
| [in] | maxiter | (Optional)
Maximum number of iterations. (maxiter > 0) (default = 500) |
|