Makes a canonical index to the distribution.
Canonical means that it respects the distribution.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_type), | intent(inout) | :: | matrix |
matrix for which to make canonical index |
||
logical, | intent(in), | optional | :: | cp2k |
make CP2K triangular index from canonical; default is false |
SUBROUTINE dbcsr_make_index_canonical(matrix, cp2k)
!! Makes a canonical index to the distribution.
!!
!! Canonical means that it respects the distribution.
TYPE(dbcsr_type), INTENT(INOUT) :: matrix
!! matrix for which to make canonical index
LOGICAL, INTENT(IN), OPTIONAL :: cp2k
!! make CP2K triangular index from canonical; default is false
INTEGER :: nb, nc, nr
INTEGER, ALLOCATABLE, DIMENSION(:) :: new_blk_p, new_col_i, new_row_p
LOGICAL :: rev
! ---------------------------------------------------------------------------
rev = .FALSE.
IF (PRESENT(cp2k)) rev = cp2k
nr = SIZE(matrix%row_p)
ALLOCATE (new_row_p(nr))
nc = SIZE(matrix%col_i)
ALLOCATE (new_col_i(nc))
nb = SIZE(matrix%blk_p)
ALLOCATE (new_blk_p(nb))
IF (rev) THEN
CALL make_index_triangular(new_row_p, new_col_i, new_blk_p, &
matrix%row_p, matrix%col_i, matrix%blk_p, matrix)
ELSE
CALL make_index_canonical(new_row_p, new_col_i, new_blk_p, &
matrix%row_p, matrix%col_i, matrix%blk_p, matrix)
END IF
matrix%row_p(:) = new_row_p
matrix%col_i(:) = new_col_i
matrix%blk_p(:) = new_blk_p
END SUBROUTINE dbcsr_make_index_canonical