Given a symmetric (positive definite) matrix , solves the linear system
using the Conjugate Gradient method.
References
call cg(A, b, x, info [, rtol] [, atol] [, preconditioner] [, options])
A : Linear operator derived from one of the abstract_sym_linop or abstract_hermitian_linop
types provided by the AbstractLinops module. It is an intent(inout) argument.
b : Right-hand side vector derived from one the abstract_vector types provided
by the AbstractVectors module. It needs to have the same type and kind as A.
It is an intent(in) argument.
x : On entry, initial guess for the solution. On exit, the solution computed by
cg. It is a vector derived from one the abstract_vector types provided by the
AbstractVectors module. It needs to have the same type and kind as A. It is
an intent(inout) argument.
info : integer information flag.
rtol (optional) : real relative tolerance for the solver.
atol (optional) : real absolute tolerance for the solver.
preconditioner (optional) : Right preconditioner used to solve the system. It needs to be
consistent with the abstract_preconditioner interface.
It is an optional intent(in) argument.
options (optional) : Container for the gmres options given by the cg_opts type.
It is an optional intent(in) argument.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_hermitian_linop_cdp), | intent(inout) | :: | A |
Linear operator to be inverted. |
||
| class(abstract_vector_cdp), | intent(in) | :: | b |
Right-hand side vector. |
||
| class(abstract_vector_cdp), | intent(inout) | :: | x |
Solution vector. |
||
| integer, | intent(out) | :: | info |
Information flag. |
||
| real(kind=dp), | intent(in), | optional | :: | rtol |
Relative solver tolerance |
|
| real(kind=dp), | intent(in), | optional | :: | atol |
Absolute solver tolerance |
|
| class(abstract_precond_cdp), | intent(inout), | optional | :: | preconditioner |
Preconditioner (not yet supported). |
|
| type(cg_dp_opts), | intent(in), | optional | :: | options |
Options for the conjugate gradient solver. |
|
| class(abstract_metadata), | intent(out), | optional | :: | meta |
Metadata. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_hermitian_linop_csp), | intent(inout) | :: | A |
Linear operator to be inverted. |
||
| class(abstract_vector_csp), | intent(in) | :: | b |
Right-hand side vector. |
||
| class(abstract_vector_csp), | intent(inout) | :: | x |
Solution vector. |
||
| integer, | intent(out) | :: | info |
Information flag. |
||
| real(kind=sp), | intent(in), | optional | :: | rtol |
Relative solver tolerance |
|
| real(kind=sp), | intent(in), | optional | :: | atol |
Absolute solver tolerance |
|
| class(abstract_precond_csp), | intent(inout), | optional | :: | preconditioner |
Preconditioner (not yet supported). |
|
| type(cg_sp_opts), | intent(in), | optional | :: | options |
Options for the conjugate gradient solver. |
|
| class(abstract_metadata), | intent(out), | optional | :: | meta |
Metadata. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_sym_linop_rdp), | intent(inout) | :: | A |
Linear operator to be inverted. |
||
| class(abstract_vector_rdp), | intent(in) | :: | b |
Right-hand side vector. |
||
| class(abstract_vector_rdp), | intent(inout) | :: | x |
Solution vector. |
||
| integer, | intent(out) | :: | info |
Information flag. |
||
| real(kind=dp), | intent(in), | optional | :: | rtol |
Relative solver tolerance |
|
| real(kind=dp), | intent(in), | optional | :: | atol |
Absolute solver tolerance |
|
| class(abstract_precond_rdp), | intent(inout), | optional | :: | preconditioner |
Preconditioner (not yet supported). |
|
| type(cg_dp_opts), | intent(in), | optional | :: | options |
Options for the conjugate gradient solver. |
|
| class(abstract_metadata), | intent(out), | optional | :: | meta |
Metadata. |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(abstract_sym_linop_rsp), | intent(inout) | :: | A |
Linear operator to be inverted. |
||
| class(abstract_vector_rsp), | intent(in) | :: | b |
Right-hand side vector. |
||
| class(abstract_vector_rsp), | intent(inout) | :: | x |
Solution vector. |
||
| integer, | intent(out) | :: | info |
Information flag. |
||
| real(kind=sp), | intent(in), | optional | :: | rtol |
Relative solver tolerance |
|
| real(kind=sp), | intent(in), | optional | :: | atol |
Absolute solver tolerance |
|
| class(abstract_precond_rsp), | intent(inout), | optional | :: | preconditioner |
Preconditioner (not yet supported). |
|
| type(cg_sp_opts), | intent(in), | optional | :: | options |
Options for the conjugate gradient solver. |
|
| class(abstract_metadata), | intent(out), | optional | :: | meta |
Metadata. |