csr_create_nzerow Subroutine

private subroutine csr_create_nzerow(csr_mat, nzerow)

create a vector containing the number of non-zero elements in each row of a CSR matrix

Arguments

Type IntentOptional 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


Source Code

   SUBROUTINE csr_create_nzerow(csr_mat, nzerow)
      !! create a vector containing the number of non-zero elements in each
      !! row of a CSR matrix

      TYPE(csr_type), INTENT(IN)                         :: csr_mat
         !! CSR matrix
      INTEGER, DIMENSION(:), INTENT(INOUT), POINTER      :: nzerow
         !! number of non-zero elements in each row

      CHARACTER(LEN=*), PARAMETER :: routineN = 'csr_create_nzerow'

      INTEGER                                            :: handle, k

      CALL timeset(routineN, handle)

      IF (.NOT. csr_mat%valid) &
         DBCSR_ABORT("CSR matrix must be created.")

      DO k = 1, csr_mat%nrows_local
         nzerow(k) = csr_mat%rowptr_local(k + 1) - csr_mat%rowptr_local(k)
      END DO

      CALL timestop(handle)
   END SUBROUTINE csr_create_nzerow