add_scalar_to_diagonal_dp Module Subroutine

module subroutine add_scalar_to_diagonal_dp(matrix_, scalar_)

add a scalar value to the matrix diagonal

Arguments

Type IntentOptional Attributes Name
real(kind=dp), intent(inout) :: matrix_(:,:)
real(kind=dp), intent(in) :: scalar_

Contents


Variables

Type Visibility Attributes Name Initial
integer(kind=int32), private :: i_
integer(kind=int32), private :: size_

Source Code

      module subroutine add_scalar_to_diagonal_dp(matrix_, scalar_)
         !! add a scalar value to the matrix diagonal 
         real(dp), intent(inout) :: matrix_(:,:)
         real(dp), intent(in) :: scalar_
         !---------------------------------------------------------------------!
         integer(int32) :: i_, size_
         !---------------------------------------------------------------------!
         size_ = size(matrix_, dim = 1)
         !---------------------------------------------------------------------!
         do i_ = 1, size_
           matrix_(i_, i_) = matrix_(i_, i_) + scalar_
         enddo
         !---------------------------------------------------------------------!
      end subroutine add_scalar_to_diagonal_dp