DBCSR to CSR matrix format conversion
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=*), | private, | parameter | :: | moduleN | = | 'dbcsr_csr_conversions' | |
logical, | private, | parameter | :: | careful_mod | = | .FALSE. | |
integer, | public, | parameter | :: | csr_dbcsr_blkrow_dist | = | 1 | |
integer, | public, | parameter | :: | csr_eqrow_ceil_dist | = | 2 | |
integer, | public, | parameter | :: | csr_eqrow_floor_dist | = | 3 |
Create a new CSR matrix and allocate all internal data (excluding dbcsr_mapping)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(out) | :: | csr_mat |
CSR matrix to return |
||
integer, | intent(in) | :: | nrows_total |
total number of rows total number of columns |
||
integer, | intent(in) | :: | ncols_total |
total number of rows total number of columns |
||
integer(kind=int_8) | :: | nze_total |
total number of non-zero elements |
|||
integer, | intent(in) | :: | nze_local |
local number of non-zero elements local number of rows |
||
integer, | intent(in) | :: | nrows_local |
local number of non-zero elements local number of rows |
||
type(mp_comm_type), | intent(in) | :: | mp_group | |||
integer, | intent(in), | optional | :: | data_type |
data type of the CSR matrix (default real double prec.) |
Create a new CSR matrix and allocate all internal data using an existing CSR matrix. Copies the indices but no actual matrix data.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(out) | :: | matrix_b |
Target CSR matrix |
||
type(csr_type), | intent(in) | :: | matrix_a |
Source CSR matrix |
Mapping data relating local CSR indices to local indices of a block-row distributed (BRD) DBCSR matrix, and containing the block structure of the original DBCSR matrix from which the CSR matrix was created.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | private, | DIMENSION(:), POINTER | :: | csr_to_brd_ind | => | NULL() |
csr_to_brd_ind(csr_ind) gives the location of a matrix element with CSR index csr_ind (location in nzval_local) inside the data_area of the corresponding BRD matrix. If an element of the DBCSR matrix is treated as 0 in the CSR format, the index of this value is not in csr_to_brd_ind. same as csr_to_brd_ind but inverse mapping. If a given DBCSR index dbcsr_ind points to a zero element, then brd_to_csr_ind(dbcsr_ind) is -1. |
integer, | private, | DIMENSION(:), POINTER | :: | brd_to_csr_ind | => | NULL() |
csr_to_brd_ind(csr_ind) gives the location of a matrix element with CSR index csr_ind (location in nzval_local) inside the data_area of the corresponding BRD matrix. If an element of the DBCSR matrix is treated as 0 in the CSR format, the index of this value is not in csr_to_brd_ind. same as csr_to_brd_ind but inverse mapping. If a given DBCSR index dbcsr_ind points to a zero element, then brd_to_csr_ind(dbcsr_ind) is -1. |
type(dbcsr_type), | private | :: | brd_mat | = | dbcsr_type() |
DBCSR BRD matrix acting as an intermediate step in any conversion from and to DBCSR format. |
|
logical, | private | :: | has_dbcsr_block_data | = | .FALSE. |
whether dbcsr_* fields are defined |
|
integer, | private | :: | dbcsr_nblkcols_total | = | -1 |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
|
integer, | private | :: | dbcsr_nblkrows_total | = | -1 |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
|
integer, | private | :: | dbcsr_nblks_local | = | -1 |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
|
integer, | private, | DIMENSION(:), POINTER | :: | dbcsr_row_p | => | NULL() |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
integer, | private, | DIMENSION(:), POINTER | :: | dbcsr_col_i | => | NULL() |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
integer, | private, | DIMENSION(:), POINTER | :: | dbcsr_row_blk_size | => | NULL() |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
integer, | private, | DIMENSION(:), POINTER | :: | dbcsr_col_blk_size | => | NULL() |
data from original DBCSR matrix (not block-row distributed), representing the original block structure. |
Data type of CSR matrices
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=real_4), | public, | DIMENSION(:), POINTER | :: | r_sp | => | Null() |
real, single precision data array |
real(kind=real_8), | public, | DIMENSION(:), POINTER | :: | r_dp | => | Null() |
real, double precision data array |
complex(kind=real_4), | public, | DIMENSION(:), POINTER | :: | c_sp | => | Null() |
complex, double precision data array |
complex(kind=real_8), | public, | DIMENSION(:), POINTER | :: | c_dp | => | Null() | |
integer, | public | :: | data_type | = | -1 |
data type of CSR matrix |
Type for CSR matrices
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
integer, | public | :: | nrows_total | = | -1 |
total number of rows total number of columns local number of nonzero elements local number of rows |
|
integer, | public | :: | ncols_total | = | -1 |
total number of rows total number of columns local number of nonzero elements local number of rows |
|
integer, | public | :: | nze_local | = | -1 |
total number of rows total number of columns local number of nonzero elements local number of rows |
|
integer, | public | :: | nrows_local | = | -1 |
total number of rows total number of columns local number of nonzero elements local number of rows |
|
type(mp_comm_type), | public | :: | mp_group | = | mp_comm_type() |
message-passing group ID |
|
integer(kind=int_8), | public | :: | nze_total | = | -1_int_8 |
total number of nonzero elements |
|
integer, | public, | DIMENSION(:), POINTER | :: | rowptr_local | => | NULL() |
indices of elements inside nzval_local starting a row column indices of elements inside nzval_local |
integer, | public, | DIMENSION(:), POINTER | :: | colind_local | => | NULL() |
indices of elements inside nzval_local starting a row column indices of elements inside nzval_local |
integer, | public, | DIMENSION(:), POINTER | :: | nzerow_local | => | NULL() |
indices of elements inside nzval_local starting a row column indices of elements inside nzval_local |
type(csr_data_area_type), | public | :: | nzval_local | = | csr_data_area_type() |
values of local non-zero elements, row-wise ordering. |
|
type(csr_mapping_data), | public | :: | dbcsr_mapping | = | csr_mapping_data() |
mapping data relating indices of nzval_local to indices of a block-row distributed DBCSR matrix |
|
logical, | public | :: | has_mapping | = | .FALSE. |
whether dbcsr_mapping is defined |
|
logical, | public | :: | valid | = | .FALSE. |
whether essential data (excluding dbcsr_mapping) is completely allocated |
|
logical, | public | :: | has_indices | = | .FALSE. |
whether rowptr_local and colind_local are defined |
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(csr_type), | public, | POINTER | :: | csr_mat | => | NULL() |
Helper function to assert that two DBCSR matrices have the same block structure and same sparsity pattern
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | matrix_a | |||
type(dbcsr_type), | intent(in) | :: | matrix_b |
whether matrix_a and matrix_b have the same block structure
Create a new CSR matrix and allocate all internal data (excluding dbcsr_mapping)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(out) | :: | csr_mat |
CSR matrix to return |
||
integer, | intent(in) | :: | nrows_total |
total number of rows total number of columns |
||
integer, | intent(in) | :: | ncols_total |
total number of rows total number of columns |
||
integer(kind=int_8) | :: | nze_total |
total number of non-zero elements |
|||
integer, | intent(in) | :: | nze_local |
local number of non-zero elements local number of rows |
||
integer, | intent(in) | :: | nrows_local |
local number of non-zero elements local number of rows |
||
type(mp_comm_type), | intent(in) | :: | mp_group | |||
integer, | intent(in), | optional | :: | data_type |
data type of the CSR matrix (default real double prec.) |
create a vector containing the number of non-zero elements in each row of a CSR matrix
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(in) | :: | csr_mat |
CSR matrix |
||
integer, | intent(inout), | DIMENSION(:), POINTER | :: | nzerow |
number of non-zero elements in each row |
destroy a CSR matrix
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(inout) | :: | csr_mat |
Allocate the internals of a CSR matrix using data from a block-row distributed DBCSR matrix
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | brd_mat |
block-row-distributed DBCSR matrix |
||
type(csr_type), | intent(out) | :: | csr_mat |
CSR matrix |
||
type(dbcsr_type), | intent(in) | :: | csr_sparsity_brd |
BRD matrix representing sparsity pattern of CSR matrix |
create the mapping information between a block-row distributed DBCSR matrix and the corresponding CSR matrix
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | brd_mat |
the block-row distributed DBCSR matrix |
||
integer, | intent(out), | DIMENSION(:), POINTER | :: | dbcsr_index |
csr to dbcsr index mapping dbcsr to csr index mapping |
|
integer, | intent(out), | DIMENSION(:), POINTER | :: | csr_index |
csr to dbcsr index mapping dbcsr to csr index mapping |
|
integer, | intent(out) | :: | csr_nze_local |
number of local non-zero elements |
||
type(dbcsr_type), | intent(in) | :: | csr_sparsity_brd |
sparsity of CSR matrix represented in BRD format |
Copies data from a CSR matrix to a block-row distributed DBCSR matrix. The DBCSR matrix must have a block structure consistent with the CSR matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(inout) | :: | brd_mat |
block-row distributed DBCSR matrix |
||
type(csr_type), | intent(in) | :: | csr_mat |
CSR matrix |
Convert a block-row distributed DBCSR matrix to a CSR matrix The DBCSR matrix must have a block structure consistent with the CSR matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | brd_mat |
block-row distributed DBCSR matrix |
||
type(csr_type), | intent(inout) | :: | csr_mat |
CSR matrix |
create CSR matrix including dbcsr_mapping from arbitrary DBCSR matrix in order to prepare conversion.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | dbcsr_mat | |||
type(csr_type), | intent(out) | :: | csr_mat | |||
integer, | intent(in) | :: | dist_format |
how to distribute CSR rows over processes: csr_dbcsr_blkrow_dist: the number of rows per process is adapted to the row block sizes in the DBCSR format such that blocks are not split over different processes. csr_eqrow_ceil_dist: each process holds ceiling(N/P) CSR rows. csr_eqrow_floor_dist: each process holds floor(N/P) CSR rows. |
||
type(dbcsr_type), | intent(in), | optional | :: | csr_sparsity |
DBCSR matrix containing 0 and 1, representing CSR sparsity pattern 1: non-zero element 0: zero element (not present in CSR format) Note: matrix must be of data_type dbcsr_type_real_4 or dbcsr_type_real_8 (integer types not supported) |
|
integer, | intent(in), | optional | :: | numnodes |
number of nodes to use for distributing CSR matrix (optional, default is number of nodes used for DBCSR matrix) |
Helper function to assert that a given CSR matrix and a given DBCSR matrix are consistent before doing the conversion
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(in) | :: | csr_mat | |||
type(dbcsr_type), | intent(in) | :: | dbcsr_mat |
Convert a DBCSR matrix to a CSR matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | dbcsr_mat |
DBCSR matrix to convert |
||
type(csr_type), | intent(inout) | :: | csr_mat |
correctly allocated CSR matrix |
convert a CSR matrix to a DBCSR matrix
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(inout) | :: | dbcsr_mat |
correctly allocated DBCSR matrix |
||
type(csr_type), | intent(inout) | :: | csr_mat |
CSR matrix to convert |
Apply filtering threshold eps to DBCSR blocks in order to improve CSR sparsity (currently only used for testing purposes)
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | dbcsr_mat | |||
type(dbcsr_type), | intent(out) | :: | csr_sparsity | |||
real(kind=real_8), | intent(in) | :: | eps |
Write a CSR matrix to file
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(in) | :: | csr_mat | |||
integer, | intent(in) | :: | unit_nr |
unit number to which output is written |
||
logical, | intent(in), | optional | :: | upper_triangle |
If true (default: false), write only upper triangular part of matrix |
|
real(kind=real_8), | intent(in), | optional | :: | threshold |
threshold on the absolute value of the elements to be printed |
|
logical, | intent(in), | optional | :: | binary |
Print CSR sparsity
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(csr_type), | intent(in) | :: | csr_mat | |||
integer, | intent(in) | :: | unit_nr |
Converts a DBCSR matrix to a block row distributed matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(in) | :: | dbcsr_mat |
DBCSR matrix to be converted |
||
type(dbcsr_type), | intent(out) | :: | brd_mat |
converted matrix |
||
logical, | intent(in) | :: | equal_dist |
see documentation of csr_create_from_dbcsr see documentation of csr_create_from_dbcsr |
||
logical, | intent(in) | :: | floor_dist |
see documentation of csr_create_from_dbcsr see documentation of csr_create_from_dbcsr |
||
integer, | intent(in) | :: | numnodes |
number of nodes to use for block row distribution |