Inserts diagonal blocks of a dbcsr matrix to make it a matrix with at least all diagonal blocks present
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(inout) | :: | matrix |
Matrix into which blocks should be added. |
SUBROUTINE dbcsr_reserve_diag_blocks(matrix) !! Inserts diagonal blocks of a dbcsr matrix to make it a matrix with at least all diagonal blocks present TYPE(dbcsr_type), INTENT(INOUT) :: matrix !! Matrix into which blocks should be added. INTEGER :: blk_count, col, col_s, myrank, rank, & row, row_s INTEGER, ALLOCATABLE, DIMENSION(:) :: columns, rows LOGICAL :: tr myrank = dbcsr_mp_mynode(dbcsr_distribution_mp(dbcsr_distribution(matrix))) blk_count = 0 ! should be possible to loop only over the local blockrows/blockcols DO row = 1, dbcsr_nblkrows_total(matrix) col = row tr = .FALSE. row_s = row; col_s = col CALL dbcsr_get_stored_coordinates(matrix, row_s, col_s, rank) IF (rank .EQ. myrank .AND. row_s .EQ. row .AND. col_s .EQ. col) blk_count = blk_count + 1 END DO ALLOCATE (rows(blk_count), columns(blk_count)) blk_count = 0 DO row = 1, dbcsr_nblkrows_total(matrix) col = row tr = .FALSE. row_s = row; col_s = col CALL dbcsr_get_stored_coordinates(matrix, row_s, col_s, rank) IF (rank .EQ. myrank .AND. row_s .EQ. row .AND. col_s .EQ. col) THEN blk_count = blk_count + 1 rows(blk_count) = row columns(blk_count) = col END IF END DO CALL dbcsr_reserve_blocks(matrix, rows, columns) END SUBROUTINE dbcsr_reserve_diag_blocks