ALP User Documentation
0.8.preview
Algebraic Programming User Documentation
|
This exposes a transition path API to the linear system solvers implemented in ALP. More...
Typedefs | |
typedef void * | sparse_cg_handle_t |
A solver handle for the Conjugate Gradient algorithm. | |
typedef int(* | sparse_cg_preconditioner_dxx_t) (double *const, const double *const, void *const) |
A user-defined preconditioner function type for CG solver that employ double-precision floating-point nonzero values. More... | |
typedef int(* | sparse_cg_preconditioner_sxx_t) (float *const, const float *const, void *const) |
A user-defined preconditioner function type for CG solver that employ single-precision floating-point nonzero values. More... | |
Enumerations | |
enum | sparse_err_t { NO_ERROR, NULL_ARGUMENT, ILLEGAL_ARGUMENT, OUT_OF_MEMORY, FAILED, UNKNOWN } |
The various error codes sparse solver library functions may return. More... | |
Functions | |
sparse_err_t | sparse_cg_destroy_dii (sparse_cg_handle_t handle) |
Destroys a valid CG solver handle. More... | |
sparse_err_t | sparse_cg_destroy_diz (sparse_cg_handle_t handle) |
Destroys a valid CG solver handle. More... | |
sparse_err_t | sparse_cg_destroy_dzz (sparse_cg_handle_t handle) |
Destroys a valid CG solver handle. More... | |
sparse_err_t | sparse_cg_destroy_sii (sparse_cg_handle_t handle) |
Destroys a valid CG solver handle. More... | |
sparse_err_t | sparse_cg_destroy_siz (sparse_cg_handle_t handle) |
Destroys a valid CG solver handle. More... | |
sparse_err_t | sparse_cg_destroy_szz (sparse_cg_handle_t handle) |
Destroys a valid CG solver handle. More... | |
sparse_err_t | sparse_cg_get_iter_count_dii (const sparse_cg_handle_t handle, size_t *const iters) |
Retrieves the number of iterations the given CG solver has employed. More... | |
sparse_err_t | sparse_cg_get_iter_count_diz (const sparse_cg_handle_t handle, size_t *const iters) |
Retrieves the number of iterations the given CG solver has employed. More... | |
sparse_err_t | sparse_cg_get_iter_count_dzz (const sparse_cg_handle_t handle, size_t *const iters) |
Retrieves the number of iterations the given CG solver has employed. More... | |
sparse_err_t | sparse_cg_get_iter_count_sii (const sparse_cg_handle_t handle, size_t *const iters) |
Retrieves the number of iterations the given CG solver has employed. More... | |
sparse_err_t | sparse_cg_get_iter_count_siz (const sparse_cg_handle_t handle, size_t *const iters) |
Retrieves the number of iterations the given CG solver has employed. More... | |
sparse_err_t | sparse_cg_get_iter_count_szz (const sparse_cg_handle_t handle, size_t *const iters) |
Retrieves the number of iterations the given CG solver has employed. More... | |
sparse_err_t | sparse_cg_get_preconditioner_dii (const sparse_cg_handle_t handle, sparse_cg_preconditioner_dxx_t *const preconditioner, void **const data) |
Retrieves the currently active preconditioner. More... | |
sparse_err_t | sparse_cg_get_preconditioner_diz (const sparse_cg_handle_t handle, sparse_cg_preconditioner_dxx_t *const preconditioner, void **const data) |
Retrieves the currently active preconditioner. More... | |
sparse_err_t | sparse_cg_get_preconditioner_dzz (const sparse_cg_handle_t handle, sparse_cg_preconditioner_dxx_t *const preconditioner, void **const data) |
Retrieves the currently active preconditioner. More... | |
sparse_err_t | sparse_cg_get_preconditioner_sii (const sparse_cg_handle_t handle, sparse_cg_preconditioner_sxx_t *const preconditioner, void **const data) |
Retrieves the currently active preconditioner. More... | |
sparse_err_t | sparse_cg_get_preconditioner_siz (const sparse_cg_handle_t handle, sparse_cg_preconditioner_sxx_t *const preconditioner, void **const data) |
Retrieves the currently active preconditioner. More... | |
sparse_err_t | sparse_cg_get_preconditioner_szz (const sparse_cg_handle_t handle, sparse_cg_preconditioner_sxx_t *const preconditioner, void **const data) |
Retrieves the currently active preconditioner. More... | |
sparse_err_t | sparse_cg_get_residual_dii (const sparse_cg_handle_t handle, double *const tol) |
Retrieves the residual the given CG solve has achieved. More... | |
sparse_err_t | sparse_cg_get_residual_diz (const sparse_cg_handle_t handle, double *const tol) |
Retrieves the residual the given CG solve has achieved. More... | |
sparse_err_t | sparse_cg_get_residual_dzz (const sparse_cg_handle_t handle, double *const tol) |
Retrieves the residual the given CG solve has achieved. More... | |
sparse_err_t | sparse_cg_get_residual_sii (const sparse_cg_handle_t handle, float *const tol) |
Retrieves the residual the given CG solve has achieved. More... | |
sparse_err_t | sparse_cg_get_residual_siz (const sparse_cg_handle_t handle, float *const tol) |
Retrieves the residual the given CG solve has achieved. More... | |
sparse_err_t | sparse_cg_get_residual_szz (const sparse_cg_handle_t handle, float *const tol) |
Retrieves the residual the given CG solve has achieved. More... | |
sparse_err_t | sparse_cg_get_size_dii (sparse_cg_handle_t const handle, size_t *const size) |
Retrieves the system size for a given CG solver handle. More... | |
sparse_err_t | sparse_cg_get_size_diz (sparse_cg_handle_t const handle, size_t *const size) |
Retrieves the system size for a given CG solver handle. More... | |
sparse_err_t | sparse_cg_get_size_dzz (sparse_cg_handle_t const handle, size_t *const size) |
Retrieves the system size for a given CG solver handle. More... | |
sparse_err_t | sparse_cg_get_size_sii (sparse_cg_handle_t const handle, size_t *const size) |
Retrieves the system size for a given CG solver handle. More... | |
sparse_err_t | sparse_cg_get_size_siz (sparse_cg_handle_t const handle, size_t *const size) |
Retrieves the system size for a given CG solver handle. More... | |
sparse_err_t | sparse_cg_get_size_szz (sparse_cg_handle_t const handle, size_t *const size) |
Retrieves the system size for a given CG solver handle. More... | |
sparse_err_t | sparse_cg_get_tolerance_dii (const sparse_cg_handle_t handle, double *const tol) |
Gets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_get_tolerance_diz (const sparse_cg_handle_t handle, double *const tol) |
Gets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_get_tolerance_dzz (const sparse_cg_handle_t handle, double *const tol) |
Gets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_get_tolerance_sii (const sparse_cg_handle_t handle, float *const tol) |
Gets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_get_tolerance_siz (const sparse_cg_handle_t handle, float *const tol) |
Gets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_get_tolerance_szz (const sparse_cg_handle_t handle, float *const tol) |
Gets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_init_dii (sparse_cg_handle_t *const handle, const size_t n, const double *const a, const int *const ja, const int *const ia) |
Initialises a sparse_cg_handle_t object. More... | |
sparse_err_t | sparse_cg_init_diz (sparse_cg_handle_t *const handle, const size_t n, const double *const a, const int *const ja, const size_t *const ia) |
Initialises a sparse_cg_handle_t object. More... | |
sparse_err_t | sparse_cg_init_dzz (sparse_cg_handle_t *const handle, const size_t n, const double *const a, const size_t *const ja, const size_t *const ia) |
Initialises a sparse_cg_handle_t object. More... | |
sparse_err_t | sparse_cg_init_sii (sparse_cg_handle_t *const handle, const size_t n, const float *const a, const int *const ja, const int *const ia) |
Initialises a sparse_cg_handle_t object. More... | |
sparse_err_t | sparse_cg_init_siz (sparse_cg_handle_t *const handle, const size_t n, const float *const a, const int *const ja, const size_t *const ia) |
Initialises a sparse_cg_handle_t object. More... | |
sparse_err_t | sparse_cg_init_szz (sparse_cg_handle_t *const handle, const size_t n, const float *const a, const size_t *const ja, const size_t *const ia) |
Initialises a sparse_cg_handle_t object. More... | |
sparse_err_t | sparse_cg_set_max_iter_count_dii (sparse_cg_handle_t handle, const size_t max_iters) |
Sets the current maximum number of iterations for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_max_iter_count_diz (sparse_cg_handle_t handle, const size_t max_iters) |
Sets the current maximum number of iterations for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_max_iter_count_dzz (sparse_cg_handle_t handle, const size_t max_iters) |
Sets the current maximum number of iterations for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_max_iter_count_sii (sparse_cg_handle_t handle, const size_t max_iters) |
Sets the current maximum number of iterations for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_max_iter_count_siz (sparse_cg_handle_t handle, const size_t max_iters) |
Sets the current maximum number of iterations for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_max_iter_count_szz (sparse_cg_handle_t handle, const size_t max_iters) |
Sets the current maximum number of iterations for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_preconditioner_dii (const sparse_cg_handle_t handle, const sparse_cg_preconditioner_dxx_t preconditioner, void *const data) |
Sets a new preconditioner to apply during a next solve call. More... | |
sparse_err_t | sparse_cg_set_preconditioner_diz (const sparse_cg_handle_t handle, const sparse_cg_preconditioner_dxx_t preconditioner, void *const data) |
Sets a new preconditioner to apply during a next solve call. More... | |
sparse_err_t | sparse_cg_set_preconditioner_dzz (const sparse_cg_handle_t handle, const sparse_cg_preconditioner_dxx_t preconditioner, void *const data) |
Sets a new preconditioner to apply during a next solve call. More... | |
sparse_err_t | sparse_cg_set_preconditioner_sii (const sparse_cg_handle_t handle, const sparse_cg_preconditioner_sxx_t preconditioner, void *const data) |
Sets a new preconditioner to apply during a next solve call. More... | |
sparse_err_t | sparse_cg_set_preconditioner_siz (const sparse_cg_handle_t handle, const sparse_cg_preconditioner_sxx_t preconditioner, void *const data) |
Sets a new preconditioner to apply during a next solve call. More... | |
sparse_err_t | sparse_cg_set_preconditioner_szz (const sparse_cg_handle_t handle, const sparse_cg_preconditioner_sxx_t preconditioner, void *const data) |
Sets a new preconditioner to apply during a next solve call. More... | |
sparse_err_t | sparse_cg_set_tolerance_dii (sparse_cg_handle_t handle, const double tol) |
Sets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_tolerance_diz (sparse_cg_handle_t handle, const double tol) |
Sets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_tolerance_dzz (sparse_cg_handle_t handle, const double tol) |
Sets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_tolerance_sii (sparse_cg_handle_t handle, const float tol) |
Sets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_tolerance_siz (sparse_cg_handle_t handle, const float tol) |
Sets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_set_tolerance_szz (sparse_cg_handle_t handle, const float tol) |
Sets the current accepted relative tolerance for the given CG solver. More... | |
sparse_err_t | sparse_cg_solve_dii (sparse_cg_handle_t handle, double *const x, const double *const b) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x. More... | |
sparse_err_t | sparse_cg_solve_diz (sparse_cg_handle_t handle, double *const x, const double *const b) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x. More... | |
sparse_err_t | sparse_cg_solve_dzz (sparse_cg_handle_t handle, double *const x, const double *const b) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x. More... | |
sparse_err_t | sparse_cg_solve_sii (sparse_cg_handle_t handle, float *const x, const float *const b) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x. More... | |
sparse_err_t | sparse_cg_solve_siz (sparse_cg_handle_t handle, float *const x, const float *const b) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x. More... | |
sparse_err_t | sparse_cg_solve_szz (sparse_cg_handle_t handle, float *const x, const float *const b) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x. More... | |
This exposes a transition path API to the linear system solvers implemented in ALP.
The primary benefit compared to simply using a SpBLAS or SparseBLAS interface, is that solvers herein defined can be compiled using the nonblocking backend, thus automatically optimising across (Sparse)BLAS primitives. This is an experimental feature designed to evaluate exactly this advantage.
The C-style interface here defined expects the industry-standard Compressed Row Storage (CRS) for matrices, also known as CSR. It employs a systematic postfix to the functions it defines. For example, the basic functions of the Conjugate Gradient solver are:
sparse_cg_init_xyy
,sparse_cg_solve_xyy
, andsparse_cg_destroy_xyy
.First explaining the postfix system, each of the above x
characters may be d
or s
, indicating the precision used during the solve: double- or single-precision, respectively.
Each of the y
characters may be z
or i
, indicating the integer type used during the solve: a size_t
or a regular int
, respectively.
The first y
character indicates the integer type of the CRS column index array, which maintains for each nonzero entry on which column it resides. For really large dimension matrices, a size_t
integer type, which usually defaults to 64-bit unsigned integers, may be required.
The second y
character indicates the integer type of the row offset array of the CRS. The \( i \)-th contiguous pair \( (a, b] \) of this array indicates where in the value and column arrays the \( i \)-th row of the matrix is encoded– the start position \( a \) is inclusive whereas the end position \( b \) is exclusive. The row offset array is of size \( m + 1 \), where \( m \) is the number of rows in the matrix. Hence the last entry of the offset array is the total number of nonzeroes the matrix contains. The data type of the offset array must be size_t
when matrices contain many nonzeroes.
size_t
, then the column index array must also be of type size_t
. Certainly for matrices used with (linear) solvers, after all, the number of nonzeroes is a multiple of the number of matrix rows. Currently, the following ALP solvers are exposed:
If you require any other solver, please feel free to submit a feature request or to contact the maintainer(s).
typedef int(* sparse_cg_preconditioner_dxx_t) (double *const, const double *const, void *const) |
A user-defined preconditioner function type for CG solver that employ double-precision floating-point nonzero values.
I.e. and more precisely, a preconditioner function type for CG solver handles of types dii
, diz
, and dzz
.
A preconditioner is assumed to be a plain C function pointer, where
int
error code (where zero will be interpreted as success);double *
;const double *
;The function signature must match exactly this specification.
typedef int(* sparse_cg_preconditioner_sxx_t) (float *const, const float *const, void *const) |
A user-defined preconditioner function type for CG solver that employ single-precision floating-point nonzero values.
I.e. and more precisely, a preconditioner function type for CG solver handles of types sii
, siz
, and szz
.
A preconditioner is assumed to be a plain C function pointer, where
int
error code (where zero will be interpreted as success);float *
;const float*
;The function signature must match exactly this specification.
enum sparse_err_t |
The various error codes sparse solver library functions may return.
sparse_err_t sparse_cg_destroy_dii | ( | sparse_cg_handle_t | handle | ) |
Destroys a valid CG solver handle.
This variant is for CG solver instances of type dii
.
dii
solvers. sparse_err_t sparse_cg_destroy_diz | ( | sparse_cg_handle_t | handle | ) |
Destroys a valid CG solver handle.
This variant is for CG solver instances of type diz
.
diz
solvers. sparse_err_t sparse_cg_destroy_dzz | ( | sparse_cg_handle_t | handle | ) |
Destroys a valid CG solver handle.
This variant is for CG solver instances of type dzz
.
dzz
solvers. sparse_err_t sparse_cg_destroy_sii | ( | sparse_cg_handle_t | handle | ) |
Destroys a valid CG solver handle.
[in,out] | handle | A handle to a valid CG solver object. |
NULL
. When returning this error code, the call to this function shall have no other effects. This variant is for CG solver instances of type sii
.
sii
solvers. sparse_err_t sparse_cg_destroy_siz | ( | sparse_cg_handle_t | handle | ) |
Destroys a valid CG solver handle.
This variant is for CG solver instances of type siz
.
siz
solvers. sparse_err_t sparse_cg_destroy_szz | ( | sparse_cg_handle_t | handle | ) |
Destroys a valid CG solver handle.
This variant is for CG solver instances of type szz
.
szz
solvers. sparse_err_t sparse_cg_get_iter_count_dii | ( | const sparse_cg_handle_t | handle, |
size_t *const | iters | ||
) |
Retrieves the number of iterations the given CG solver has employed.
This variant is for CG solver instances of type dii
.
sparse_err_t sparse_cg_get_iter_count_diz | ( | const sparse_cg_handle_t | handle, |
size_t *const | iters | ||
) |
Retrieves the number of iterations the given CG solver has employed.
This variant is for CG solver instances of type diz
.
sparse_err_t sparse_cg_get_iter_count_dzz | ( | const sparse_cg_handle_t | handle, |
size_t *const | iters | ||
) |
Retrieves the number of iterations the given CG solver has employed.
This variant is for CG solver instances of type dzz
.
sparse_err_t sparse_cg_get_iter_count_sii | ( | const sparse_cg_handle_t | handle, |
size_t *const | iters | ||
) |
Retrieves the number of iterations the given CG solver has employed.
[in] | handle | A handle to a valid CG solver object. |
[out] | iters | Where to store the requested number of iterations. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver instances of type sii
.
sparse_err_t sparse_cg_get_iter_count_siz | ( | const sparse_cg_handle_t | handle, |
size_t *const | iters | ||
) |
Retrieves the number of iterations the given CG solver has employed.
This variant is for CG solver instances of type siz
.
sparse_err_t sparse_cg_get_iter_count_szz | ( | const sparse_cg_handle_t | handle, |
size_t *const | iters | ||
) |
Retrieves the number of iterations the given CG solver has employed.
This variant is for CG solver instances of type szz
.
sparse_err_t sparse_cg_get_preconditioner_dii | ( | const sparse_cg_handle_t | handle, |
sparse_cg_preconditioner_dxx_t *const | preconditioner, | ||
void **const | data | ||
) |
Retrieves the currently active preconditioner.
[in,out] | handle | A handle to a valid CG solver object. |
[out] | preconditioner | Where to store the function pointer that is the current preconditioner. |
[out] | data | Where to store the pointer to any data that the currently active preconditioner requires. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver handles of type dii
.
sparse_err_t sparse_cg_get_preconditioner_diz | ( | const sparse_cg_handle_t | handle, |
sparse_cg_preconditioner_dxx_t *const | preconditioner, | ||
void **const | data | ||
) |
Retrieves the currently active preconditioner.
[in,out] | handle | A handle to a valid CG solver object. |
[out] | preconditioner | Where to store the function pointer that is the current preconditioner. |
[out] | data | Where to store the pointer to any data that the currently active preconditioner requires. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver handles of type diz
.
sparse_err_t sparse_cg_get_preconditioner_dzz | ( | const sparse_cg_handle_t | handle, |
sparse_cg_preconditioner_dxx_t *const | preconditioner, | ||
void **const | data | ||
) |
Retrieves the currently active preconditioner.
[in,out] | handle | A handle to a valid CG solver object. |
[out] | preconditioner | Where to store the function pointer that is the current preconditioner. |
[out] | data | Where to store the pointer to any data that the currently active preconditioner requires. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver handles of type dzz
.
sparse_err_t sparse_cg_get_preconditioner_sii | ( | const sparse_cg_handle_t | handle, |
sparse_cg_preconditioner_sxx_t *const | preconditioner, | ||
void **const | data | ||
) |
Retrieves the currently active preconditioner.
[in,out] | handle | A handle to a valid CG solver object. |
[out] | preconditioner | Where to store the function pointer that is the current preconditioner. |
[out] | data | Where to store the pointer to any data that the currently active preconditioner requires. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver handles of type sii
.
sparse_err_t sparse_cg_get_preconditioner_siz | ( | const sparse_cg_handle_t | handle, |
sparse_cg_preconditioner_sxx_t *const | preconditioner, | ||
void **const | data | ||
) |
Retrieves the currently active preconditioner.
[in,out] | handle | A handle to a valid CG solver object. |
[out] | preconditioner | Where to store the function pointer that is the current preconditioner. |
[out] | data | Where to store the pointer to any data that the currently active preconditioner requires. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver handles of type siz
.
sparse_err_t sparse_cg_get_preconditioner_szz | ( | const sparse_cg_handle_t | handle, |
sparse_cg_preconditioner_sxx_t *const | preconditioner, | ||
void **const | data | ||
) |
Retrieves the currently active preconditioner.
[in,out] | handle | A handle to a valid CG solver object. |
[out] | preconditioner | Where to store the function pointer that is the current preconditioner. |
[out] | data | Where to store the pointer to any data that the currently active preconditioner requires. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver handles of type szz
.
sparse_err_t sparse_cg_get_residual_dii | ( | const sparse_cg_handle_t | handle, |
double *const | tol | ||
) |
Retrieves the residual the given CG solve has achieved.
This variant is for CG solver instances of type dii
.
sparse_err_t sparse_cg_get_residual_diz | ( | const sparse_cg_handle_t | handle, |
double *const | tol | ||
) |
Retrieves the residual the given CG solve has achieved.
This variant is for CG solver instances of type diz
.
sparse_err_t sparse_cg_get_residual_dzz | ( | const sparse_cg_handle_t | handle, |
double *const | tol | ||
) |
Retrieves the residual the given CG solve has achieved.
This variant is for CG solver instances of type dzz
.
sparse_err_t sparse_cg_get_residual_sii | ( | const sparse_cg_handle_t | handle, |
float *const | tol | ||
) |
Retrieves the residual the given CG solve has achieved.
[in] | handle | A handle to a valid CG solver object. |
[out] | tol | Where to store the requested residual. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver instances of type sii
.
sparse_err_t sparse_cg_get_residual_siz | ( | const sparse_cg_handle_t | handle, |
float *const | tol | ||
) |
Retrieves the residual the given CG solve has achieved.
This variant is for CG solver instances of type siz
.
sparse_err_t sparse_cg_get_residual_szz | ( | const sparse_cg_handle_t | handle, |
float *const | tol | ||
) |
Retrieves the residual the given CG solve has achieved.
This variant is for CG solver instances of type szz
.
sparse_err_t sparse_cg_get_size_dii | ( | sparse_cg_handle_t const | handle, |
size_t *const | size | ||
) |
Retrieves the system size for a given CG solver handle.
[in] | handle | A handle to a valid CG solver object. |
[out] | size | Where to store the system size. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solve instances of type dii
.
sparse_err_t sparse_cg_get_size_diz | ( | sparse_cg_handle_t const | handle, |
size_t *const | size | ||
) |
Retrieves the system size for a given CG solver handle.
[in] | handle | A handle to a valid CG solver object. |
[out] | size | Where to store the system size. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solve instances of type diz
.
sparse_err_t sparse_cg_get_size_dzz | ( | sparse_cg_handle_t const | handle, |
size_t *const | size | ||
) |
Retrieves the system size for a given CG solver handle.
[in] | handle | A handle to a valid CG solver object. |
[out] | size | Where to store the system size. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solve instances of type dzz
.
sparse_err_t sparse_cg_get_size_sii | ( | sparse_cg_handle_t const | handle, |
size_t *const | size | ||
) |
Retrieves the system size for a given CG solver handle.
[in] | handle | A handle to a valid CG solver object. |
[out] | size | Where to store the system size. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solve instances of type sii
.
sparse_err_t sparse_cg_get_size_siz | ( | sparse_cg_handle_t const | handle, |
size_t *const | size | ||
) |
Retrieves the system size for a given CG solver handle.
[in] | handle | A handle to a valid CG solver object. |
[out] | size | Where to store the system size. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solve instances of type siz
.
sparse_err_t sparse_cg_get_size_szz | ( | sparse_cg_handle_t const | handle, |
size_t *const | size | ||
) |
Retrieves the system size for a given CG solver handle.
[in] | handle | A handle to a valid CG solver object. |
[out] | size | Where to store the system size. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solve instances of type szz
.
sparse_err_t sparse_cg_get_tolerance_dii | ( | const sparse_cg_handle_t | handle, |
double *const | tol | ||
) |
Gets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type dii
.
sparse_err_t sparse_cg_get_tolerance_diz | ( | const sparse_cg_handle_t | handle, |
double *const | tol | ||
) |
Gets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type diz
.
sparse_err_t sparse_cg_get_tolerance_dzz | ( | const sparse_cg_handle_t | handle, |
double *const | tol | ||
) |
Gets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type dzz
.
sparse_err_t sparse_cg_get_tolerance_sii | ( | const sparse_cg_handle_t | handle, |
float *const | tol | ||
) |
Gets the current accepted relative tolerance for the given CG solver.
[in] | handle | A handle to a valid CG solver object. |
[out] | tol | Where to store the currently effective tolerance. |
NULL
. If this error is returned, the call to this function shall not have any other effects. NULL
. If this error code is returned, the call to this function shall have no other effects. This variant is for CG solver instances of type sii
.
sparse_err_t sparse_cg_get_tolerance_siz | ( | const sparse_cg_handle_t | handle, |
float *const | tol | ||
) |
Gets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type siz
.
sparse_err_t sparse_cg_get_tolerance_szz | ( | const sparse_cg_handle_t | handle, |
float *const | tol | ||
) |
Gets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type szz
.
sparse_err_t sparse_cg_init_dii | ( | sparse_cg_handle_t *const | handle, |
const size_t | n, | ||
const double *const | a, | ||
const int *const | ja, | ||
const int *const | ia | ||
) |
Initialises a sparse_cg_handle_t object.
This variant is for double-precision floating point nonzeroes and integer ja and ia arrays, as also indicated by the dii
postfix.
sparse_err_t sparse_cg_init_diz | ( | sparse_cg_handle_t *const | handle, |
const size_t | n, | ||
const double *const | a, | ||
const int *const | ja, | ||
const size_t *const | ia | ||
) |
Initialises a sparse_cg_handle_t object.
This variant is for double-precision floating point nonzeroes, size_t
-valued ja, and integer-valued ia, as also indicated by the diz
postfix.
sparse_err_t sparse_cg_init_dzz | ( | sparse_cg_handle_t *const | handle, |
const size_t | n, | ||
const double *const | a, | ||
const size_t *const | ja, | ||
const size_t *const | ia | ||
) |
Initialises a sparse_cg_handle_t object.
This variant is for double-precision floating point nonzeroes and size_t
-valued ja and ia, as also indicated by the dzz
postfix.
sparse_err_t sparse_cg_init_sii | ( | sparse_cg_handle_t *const | handle, |
const size_t | n, | ||
const float *const | a, | ||
const int *const | ja, | ||
const int *const | ia | ||
) |
Initialises a sparse_cg_handle_t object.
[out] | handle | An uninitialised handler to a CG solver. |
Initialisation proceeds according to a given system matrix given in Compressed Row Storage (CRS), also commonly known as the Compressed Sparse Rows (CSR) format.
[in] | n | The size of the system matrix. |
[in] | a | The nonzero values of the system matrix. |
[in] | ja | The column indices of the nonzeroes of the system matrix. |
[in] | ia | The row offset array of the system matrix. |
This variant is for single-precision floating point nonzeroes and integer ja and ia arrays, as also indicated by the sii
postfix.
NULL
. NULL
. On returning any of the above errors, the call to this function shall not have any other effects (than having returned the error code).
NULL
handle may be reused for future, potentially successful, calls to this (or any other) initialisation function.sparse_err_t sparse_cg_init_siz | ( | sparse_cg_handle_t *const | handle, |
const size_t | n, | ||
const float *const | a, | ||
const int *const | ja, | ||
const size_t *const | ia | ||
) |
Initialises a sparse_cg_handle_t object.
This variant is for single-precision floating point nonzeroes, size_t
-valued ja, and integer-valued ia, as also indicated by the siz
postfix.
sparse_err_t sparse_cg_init_szz | ( | sparse_cg_handle_t *const | handle, |
const size_t | n, | ||
const float *const | a, | ||
const size_t *const | ja, | ||
const size_t *const | ia | ||
) |
Initialises a sparse_cg_handle_t object.
This variant is for single-precision floating point nonzeroes and size_t
-valued ja and ia, as also indicated by the szz
postfix.
sparse_err_t sparse_cg_set_max_iter_count_dii | ( | sparse_cg_handle_t | handle, |
const size_t | max_iters | ||
) |
Sets the current maximum number of iterations for the given CG solver.
This variant is for CG solver instances of type dii
.
sparse_err_t sparse_cg_set_max_iter_count_diz | ( | sparse_cg_handle_t | handle, |
const size_t | max_iters | ||
) |
Sets the current maximum number of iterations for the given CG solver.
This variant is for CG solver instances of type diz
.
sparse_err_t sparse_cg_set_max_iter_count_dzz | ( | sparse_cg_handle_t | handle, |
const size_t | max_iters | ||
) |
Sets the current maximum number of iterations for the given CG solver.
This variant is for CG solver instances of type dzz
.
sparse_err_t sparse_cg_set_max_iter_count_sii | ( | sparse_cg_handle_t | handle, |
const size_t | max_iters | ||
) |
Sets the current maximum number of iterations for the given CG solver.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | max_iters | The given maximum number of iterations. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver instances of type sii
.
sparse_err_t sparse_cg_set_max_iter_count_siz | ( | sparse_cg_handle_t | handle, |
const size_t | max_iters | ||
) |
Sets the current maximum number of iterations for the given CG solver.
This variant is for CG solver instances of type siz
.
sparse_err_t sparse_cg_set_max_iter_count_szz | ( | sparse_cg_handle_t | handle, |
const size_t | max_iters | ||
) |
Sets the current maximum number of iterations for the given CG solver.
This variant is for CG solver instances of type szz
.
sparse_err_t sparse_cg_set_preconditioner_dii | ( | const sparse_cg_handle_t | handle, |
const sparse_cg_preconditioner_dxx_t | preconditioner, | ||
void *const | data | ||
) |
Sets a new preconditioner to apply during a next solve call.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | preconditioner | The preconditioner as a C function pointer. |
[in] | data | Pointer to any data the preconditioner may require. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver handles of type dii
.
sparse_err_t sparse_cg_set_preconditioner_diz | ( | const sparse_cg_handle_t | handle, |
const sparse_cg_preconditioner_dxx_t | preconditioner, | ||
void *const | data | ||
) |
Sets a new preconditioner to apply during a next solve call.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | preconditioner | The preconditioner as a C function pointer. |
[in] | data | Pointer to any data the preconditioner may require. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver handles of type dii
.
sparse_err_t sparse_cg_set_preconditioner_dzz | ( | const sparse_cg_handle_t | handle, |
const sparse_cg_preconditioner_dxx_t | preconditioner, | ||
void *const | data | ||
) |
Sets a new preconditioner to apply during a next solve call.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | preconditioner | The preconditioner as a C function pointer. |
[in] | data | Pointer to any data the preconditioner may require. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver handles of type dii
.
sparse_err_t sparse_cg_set_preconditioner_sii | ( | const sparse_cg_handle_t | handle, |
const sparse_cg_preconditioner_sxx_t | preconditioner, | ||
void *const | data | ||
) |
Sets a new preconditioner to apply during a next solve call.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | preconditioner | The preconditioner as a C function pointer. |
[in] | data | Pointer to any data the preconditioner may require. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver handles of type sii
.
sparse_err_t sparse_cg_set_preconditioner_siz | ( | const sparse_cg_handle_t | handle, |
const sparse_cg_preconditioner_sxx_t | preconditioner, | ||
void *const | data | ||
) |
Sets a new preconditioner to apply during a next solve call.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | preconditioner | The preconditioner as a C function pointer. |
[in] | data | Pointer to any data the preconditioner may require. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver handles of type sii
.
sparse_err_t sparse_cg_set_preconditioner_szz | ( | const sparse_cg_handle_t | handle, |
const sparse_cg_preconditioner_sxx_t | preconditioner, | ||
void *const | data | ||
) |
Sets a new preconditioner to apply during a next solve call.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | preconditioner | The preconditioner as a C function pointer. |
[in] | data | Pointer to any data the preconditioner may require. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver handles of type sii
.
sparse_err_t sparse_cg_set_tolerance_dii | ( | sparse_cg_handle_t | handle, |
const double | tol | ||
) |
Sets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type dii
.
sparse_err_t sparse_cg_set_tolerance_diz | ( | sparse_cg_handle_t | handle, |
const double | tol | ||
) |
Sets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type diz
.
sparse_err_t sparse_cg_set_tolerance_dzz | ( | sparse_cg_handle_t | handle, |
const double | tol | ||
) |
Sets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type dzz
.
sparse_err_t sparse_cg_set_tolerance_sii | ( | sparse_cg_handle_t | handle, |
const float | tol | ||
) |
Sets the current accepted relative tolerance for the given CG solver.
[in,out] | handle | A handle to a valid CG solver object. |
[in] | tol | The given tolerance. |
NULL
. If this error is returned, the call to this function shall not have any other effects. This variant is for CG solver instances of type sii
.
sparse_err_t sparse_cg_set_tolerance_siz | ( | sparse_cg_handle_t | handle, |
const float | tol | ||
) |
Sets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type siz
.
sparse_err_t sparse_cg_set_tolerance_szz | ( | sparse_cg_handle_t | handle, |
const float | tol | ||
) |
Sets the current accepted relative tolerance for the given CG solver.
This variant is for CG solver instances of type szz
.
sparse_err_t sparse_cg_solve_dii | ( | sparse_cg_handle_t | handle, |
double *const | x, | ||
const double *const | b | ||
) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x.
This variant is for CG solver instances of type dii
.
sparse_err_t sparse_cg_solve_diz | ( | sparse_cg_handle_t | handle, |
double *const | x, | ||
const double *const | b | ||
) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x.
This variant is for CG solver instances of type diz
.
sparse_err_t sparse_cg_solve_dzz | ( | sparse_cg_handle_t | handle, |
double *const | x, | ||
const double *const | b | ||
) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x.
This variant is for CG solver instances of type dzz
.
sparse_err_t sparse_cg_solve_sii | ( | sparse_cg_handle_t | handle, |
float *const | x, | ||
const float *const | b | ||
) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x.
[in] | handle | A handle to a valid CG solver object, which embeds the linear system matrix on which the solve is executed. |
[in,out] | x | On input: an initial guess to the solution. On output: the last-obtained iterative refinement of the initial guess. |
[in] | b | The right-hand side of the linear system to solve. |
The solve continues until convergence, until the maximum number of iterations has been achieved, or until an error is encountered.
Calling this function with an invalid handle will incur undefined behaviour.
NULL
. In this case, the call to this function shall not have any other effects. sparse_err_t sparse_cg_solve_siz | ( | sparse_cg_handle_t | handle, |
float *const | x, | ||
const float *const | b | ||
) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x.
This variant is for CG solver instances of type siz
.
sparse_err_t sparse_cg_solve_szz | ( | sparse_cg_handle_t | handle, |
float *const | x, | ||
const float *const | b | ||
) |
Executes a solve using a given CG solver handle, a given right-hand side b, and an initial guess x.
This variant is for CG solver instances of type szz
.