dbcsr_update_contiguous_blocks_s Subroutine

private subroutine dbcsr_update_contiguous_blocks_s(matrix_a, matrix_b, first_lb_a, first_lb_b, nze, do_scale, my_beta_scalar, found, iw)

Low level function to sum contiguous chunks of blocks of the matrices (matrix_a = matrix_a + beta*matrix_b)

Arguments

Type IntentOptional Attributes Name
type(dbcsr_type), intent(inout) :: matrix_a

DBCSR matrix

type(dbcsr_type), intent(in) :: matrix_b

DBCSR matrix

integer, intent(in) :: first_lb_a
integer, intent(in) :: first_lb_b
integer, intent(in) :: nze
logical, intent(in) :: do_scale
type(dbcsr_scalar_type), intent(in) :: my_beta_scalar
logical, intent(in) :: found
integer, intent(in) :: iw

Source Code

      SUBROUTINE dbcsr_update_contiguous_blocks_s (matrix_a, matrix_b, first_lb_a, first_lb_b, nze, &
                                                               do_scale, my_beta_scalar, found, iw)
      !! Low level function to sum contiguous chunks of blocks of the matrices (matrix_a = matrix_a + beta*matrix_b)

         TYPE(dbcsr_type), INTENT(INOUT)                         :: matrix_a
         !! DBCSR matrix
         TYPE(dbcsr_type), INTENT(IN)                            :: matrix_b
         !! DBCSR matrix
         TYPE(dbcsr_scalar_type), INTENT(IN)                     :: my_beta_scalar
         INTEGER, INTENT(IN)                                     :: first_lb_a, first_lb_b, nze, iw
         LOGICAL, INTENT(IN)                                     :: found, do_scale

         INTEGER                                                 :: ub_a, ub_b

         ub_a = first_lb_a + nze - 1
         ub_b = first_lb_b + nze - 1

         IF (found) THEN
            IF (do_scale) THEN
               CALL saxpy(nze, my_beta_scalar%r_sp, &
                                      matrix_b%data_area%d%r_sp (first_lb_b:ub_b), 1, &
                                      matrix_a%data_area%d%r_sp (first_lb_a:ub_a), 1)
            ELSE
               matrix_a%data_area%d%r_sp (first_lb_a:ub_a) = &
                  matrix_a%data_area%d%r_sp (first_lb_a:ub_a) + &
                  matrix_b%data_area%d%r_sp (first_lb_b:ub_b)
            END IF
         ELSE
            IF (do_scale) THEN
               matrix_a%wms(iw)%data_area%d%r_sp (first_lb_a:ub_a) = &
                  my_beta_scalar%r_sp* &
                  matrix_b%data_area%d%r_sp (first_lb_b:ub_b)
            ELSE
               matrix_a%wms(iw)%data_area%d%r_sp (first_lb_a:ub_a) = &
                  matrix_b%data_area%d%r_sp (first_lb_b:ub_b)
            END IF
         END IF
      END SUBROUTINE dbcsr_update_contiguous_blocks_s