calculate_norms Subroutine

public subroutine calculate_norms(matrix, norms, row_blk_sizes, col_blk_sizes)

Calculates per-block norms. Rewritten to be very low-level.

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(in) :: matrix

DBCSR matrix for which to calculate norms

real(kind=sp), intent(out), DIMENSION(:) :: norms

Block norms

integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: row_blk_sizes
integer, intent(in), DIMENSION(:), POINTER, CONTIGUOUS :: col_blk_sizes

Source Code

   SUBROUTINE calculate_norms(matrix, norms, row_blk_sizes, col_blk_sizes)
      !! Calculates per-block norms.
      !! Rewritten to be very low-level.

      TYPE(dbcsr_type), INTENT(IN)                       :: matrix
         !! DBCSR matrix for which to calculate norms
      REAL(kind=sp), DIMENSION(:), INTENT(OUT)           :: norms
         !! Block norms
      INTEGER, DIMENSION(:), POINTER, CONTIGUOUS, INTENT(IN) :: row_blk_sizes, col_blk_sizes

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

      INTEGER                                            :: data_type, handle, nblks

!   ---------------------------------------------------------------------------

      CALL timeset(routineN, handle)
      ! Checks for validity
      IF (.NOT. dbcsr_valid_index(matrix)) &
         DBCSR_ABORT("The matrix must be valid.")
      data_type = dbcsr_get_data_type(matrix)
      nblks = matrix%nblks
      SELECT CASE (data_type)
      CASE (dbcsr_type_real_4)
         CALL calc_norms_s(norms, nblks, matrix%coo_l, &
                           row_blk_sizes, col_blk_sizes, &
                           dbcsr_get_data_p_s(matrix%data_area))
      CASE (dbcsr_type_real_8)
         CALL calc_norms_d(norms, nblks, matrix%coo_l, &
                           row_blk_sizes, col_blk_sizes, &
                           dbcsr_get_data_p_d(matrix%data_area))
      CASE (dbcsr_type_complex_4)
         CALL calc_norms_c(norms, nblks, matrix%coo_l, &
                           row_blk_sizes, col_blk_sizes, &
                           dbcsr_get_data_p_c(matrix%data_area))
      CASE (dbcsr_type_complex_8)
         CALL calc_norms_z(norms, nblks, matrix%coo_l, &
                           row_blk_sizes, col_blk_sizes, &
                           dbcsr_get_data_p_z(matrix%data_area))
      CASE DEFAULT
         DBCSR_ABORT("Invalid data type.")
      END SELECT
      !
      CALL timestop(handle)
   END SUBROUTINE calculate_norms