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
FUNCTION dbcsr_has_same_block_structure(matrix_a, matrix_b) RESULT(is_equal) !! Helper function to assert that two DBCSR matrices have the same block !! structure and same sparsity pattern TYPE(dbcsr_type), INTENT(IN) :: matrix_a, matrix_b LOGICAL :: is_equal !! whether matrix_a and matrix_b have the same block structure is_equal = .TRUE. IF (dbcsr_nblkcols_total(matrix_a) .NE. dbcsr_nblkcols_total(matrix_b)) is_equal = .FALSE. IF (dbcsr_nblkrows_total(matrix_a) .NE. dbcsr_nblkrows_total(matrix_b)) is_equal = .FALSE. IF ((matrix_a%nblks) .NE. (matrix_b%nblks)) is_equal = .FALSE. IF (ANY(matrix_a%row_p .NE. matrix_b%row_p)) is_equal = .FALSE. IF (ANY(matrix_a%col_i .NE. matrix_b%col_i)) is_equal = .FALSE. IF (ANY(dbcsr_row_block_sizes(matrix_a) .NE. & dbcsr_row_block_sizes(matrix_b))) is_equal = .FALSE. IF (ANY(dbcsr_row_block_sizes(matrix_a) .NE. & dbcsr_row_block_sizes(matrix_b))) is_equal = .FALSE. END FUNCTION dbcsr_has_same_block_structure