Compressed sparse row matrix with real(dp) values.
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer(kind=default_int), | public, | allocatable | :: | col_idx(:) |
Column index of every stored entry, ascending within each row |
||
| integer(kind=default_int), | public | :: | ncol | = | 0 |
Number of columns; prefer the |
|
| integer(kind=default_int), | public | :: | nrow | = | 0 |
Number of rows; prefer the |
|
| integer(kind=default_int), | public, | allocatable | :: | row_ptr(:) |
Row start offsets, size |
||
| real(kind=dp), | public, | allocatable | :: | values(:) |
Value of every stored entry, parallel to |
Build the matrix from coordinate (COO) triplets.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(inout) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | n_rows |
Number of rows of the assembled matrix |
||
| integer(kind=default_int), | intent(in) | :: | n_cols |
Number of columns of the assembled matrix |
||
| integer(kind=default_int), | intent(in) | :: | rows(:) |
Row coordinate of each triplet |
||
| integer(kind=default_int), | intent(in) | :: | cols(:) |
Column coordinate of each triplet |
||
| real(kind=dp), | intent(in) | :: | vals(:) |
Value of each triplet |
||
| type(error_t), | intent(out), | optional | :: | err |
Release all storage and reset the matrix to an empty 0 by 0 one.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(inout) | :: | self |
Check that the stored triple is structurally consistent.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(in) | :: | self | |||
| type(error_t), | intent(out), | optional | :: | err |
.true. when the matrix is structurally sound
Sparse matrix-vector product y = A*x.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(in) | :: | self | |||
| real(kind=dp), | intent(in) | :: | x(:) |
Input vector of length |
||
| real(kind=dp), | intent(out) | :: | y(:) |
Output vector of length |
||
| type(error_t), | intent(out), | optional | :: | err |
Number of columns of the matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(in) | :: | self |
Number of rows of the matrix.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(in) | :: | self |
Copy out the column indices and values stored in row i.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(in) | :: | self | |||
| integer(kind=default_int), | intent(in) | :: | i |
Row to read, in |
||
| integer(kind=default_int), | intent(out), | allocatable | :: | cols(:) |
Column indices of row |
|
| real(kind=dp), | intent(out), | allocatable | :: | vals(:) |
Values of row |
|
| type(error_t), | intent(out), | optional | :: | err |
Build the transpose of this matrix into at.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(csr_t), | intent(in) | :: | self | |||
| type(csr_t), | intent(out) | :: | at |
Receives the transpose |
||
| type(error_t), | intent(out), | optional | :: | err |
type :: csr_t !! Compressed sparse row matrix with `real(dp)` values. integer(default_int) :: nrow = 0 !! Number of rows; prefer the `n_rows` accessor when reading integer(default_int) :: ncol = 0 !! Number of columns; prefer the `n_cols` accessor when reading integer(default_int), allocatable :: row_ptr(:) !! Row start offsets, size `nrow + 1`, one-based integer(default_int), allocatable :: col_idx(:) !! Column index of every stored entry, ascending within each row real(dp), allocatable :: values(:) !! Value of every stored entry, parallel to `col_idx` contains procedure :: build_from_coo => csr_build_from_coo procedure :: n_rows => csr_n_rows procedure :: n_cols => csr_n_cols procedure :: nnz => csr_nnz procedure :: row_slice => csr_row_slice procedure :: matvec => csr_matvec procedure :: transpose => csr_transpose procedure :: is_valid => csr_is_valid procedure :: destroy => csr_destroy end type csr_t