Algebra routines for - vectors - sparse matrices in csr format
Data type used to expose csrmat_t data to C/C++
Please see csrmat_t for descriptions of individual
properties/members.
Values are copied directly.
Arrays are exposed with pointers.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=c_int32_t), | public | :: | ndim | ||||
| integer(kind=c_int32_t), | public | :: | ncol | ||||
| integer(kind=c_int32_t), | public | :: | nnz | ||||
| type(c_ptr), | public | :: | i | ||||
| type(c_ptr), | public | :: | j | ||||
| type(c_ptr), | public | :: | val |
Compressed-sparse-row (CSR) matrix format
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public | :: | ndim |
Number of rows (dimension) |
|||
| integer, | public | :: | ncol |
Number of columns |
|||
| integer, | public | :: | nnz |
Number of non-zero elements |
|||
| integer, | public, | allocatable, dimension(:) | :: | i |
i-array in CSR format, of dimension ndim+1 |
||
| integer, | public, | allocatable, dimension(:) | :: | j |
j-array in CSR format, of dimension nnz |
||
| real(kind=FP), | public, | allocatable, dimension(:) | :: | val |
val-array in CSR format, of dimension nnz |
| final :: destructor |
| procedure, public :: write_netcdf | |
| procedure, public :: read_netcdf | |
| procedure, public :: sortsum | |
| procedure, public :: create_copy | |
| procedure, public :: display | |
| procedure, public :: expose_data |
Computes element row of vector y = A*x
Thread safe, i.e. can be called from within parallel region
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(csrmat_t), | intent(in) | :: | a |
csr matrix |
||
| real(kind=FP), | intent(in), | dimension(a%ncol) | :: | x |
vector x |
|
| integer, | intent(in) | :: | row |
row of matrix |
computes norm of difference of two vectors, i.e. ||x-y|| / n
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
dimension of vectors |
||
| real(kind=FP), | intent(in), | dimension(n) | :: | x |
vector x |
|
| real(kind=FP), | intent(in), | dimension(n) | :: | y |
vector y |
Reads csr matrix from file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csrmat_t), | intent(inout) | :: | self |
csr matrix |
||
| integer, | intent(in) | :: | fgid |
File or group id number of existing Netcdf4 file |
writes csr matrix to file
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csrmat_t), | intent(in) | :: | self |
csr matrix |
||
| integer, | intent(in) | :: | fgid |
file or group id number of existing Netcdf4 file |
sorts and sums entries in ascending j-order for each row
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csrmat_t), | intent(inout) | :: | self |
csr matrix |
displays some information on matrix
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csrmat_t), | intent(in) | :: | self |
csr matrix |
Exposes csrmat data through csrmat_data_t object
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csrmat_t), | intent(in), | target | :: | self |
Instance of the type |
|
| type(csrmat_data_t), | intent(out) | :: | data_object |
Destination csrmat data object that contains the exposed data of the csrmat object. |
destructor, frees memory
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(csrmat_t), | intent(inout) | :: | self |
csr matrix |
Multiplies matrix with vector y = A*x Thread safe, i.e. can be called from within parallel region
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(csrmat_t), | intent(in) | :: | a |
csr matrix |
||
| real(kind=FP), | intent(in), | dimension(a%ncol) | :: | x |
vector x |
|
| real(kind=FP), | intent(out), | dimension(a%ndim) | :: | y |
vector y (result) |
Computes the residuum ||Ax-b|| / (||b||+eps)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| type(csrmat_t), | intent(in) | :: | a |
csr matrix |
||
| real(kind=FP), | intent(in), | dimension(a%ncol) | :: | x |
Vector x |
|
| real(kind=FP), | intent(in), | dimension(a%ndim) | :: | b |
Vector b |
|
| real(kind=FP), | intent(out) | :: | res |
Residuum (root mean square) |
||
| real(kind=FP), | intent(out), | optional | :: | resmax |
Residuum (maximum) |
|
| real(kind=FP), | intent(in), | optional | :: | epsb |
Tolerance for division of b in residual Dafault value FP_EPS |