dbcsr_make_dbcsr_index Subroutine

public subroutine dbcsr_make_dbcsr_index(row_p, row_i, nrows, nblks)

Collapses a row_p index

Arguments

TypeIntentOptionalAttributesName
integer, intent(out), DIMENSION(1:nrows + 1):: row_p
integer, intent(in), DIMENSION(1:nblks):: row_i
integer, intent(in) :: nrows
integer, intent(in) :: nblks

Contents


Source Code

   SUBROUTINE dbcsr_make_dbcsr_index(row_p, row_i, nrows, nblks)
      !! Collapses a row_p index
      INTEGER, INTENT(in)                                :: nrows, nblks
      INTEGER, DIMENSION(1:nrows + 1), INTENT(out)       :: row_p
      INTEGER, DIMENSION(1:nblks), INTENT(in)            :: row_i

      CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_make_dbcsr_index'

      INTEGER                                            :: blk, error_handle, row

      CALL timeset(routineN, error_handle)

      row_p(1) = 0
      row_p(nrows + 1) = nblks
      row = 1
      blk = 1
      DO WHILE (row .LE. nrows)
         IF (blk .LE. nblks) THEN
            DO WHILE (row_i(blk) .EQ. row)
               blk = blk + 1
               IF (blk .GT. nblks) THEN
                  row_p(row + 1) = nblks - 1
                  EXIT
               END IF
            END DO
         END IF
         row_p(row + 1) = blk - 1
         row = row + 1
      END DO

      CALL timestop(error_handle)

   END SUBROUTINE dbcsr_make_dbcsr_index