module subroutine add_scalar_to_diagonal_int32(matrix_, scalar_)
add a scalar value to the matrix diagonal (integer).
Arguments
Type |
Intent | Optional | Attributes |
|
Name |
|
integer(kind=int32),
|
intent(inout) |
|
|
:: |
matrix_(:,:) |
|
integer(kind=int32),
|
intent(in) |
|
|
:: |
scalar_ |
|
Variables
Type |
Visibility | Attributes |
|
Name |
| Initial | |
integer(kind=int32),
|
private |
|
:: |
i_ |
|
|
|
integer(kind=int32),
|
private |
|
:: |
size_ |
|
|
|
Source Code
module subroutine add_scalar_to_diagonal_int32(matrix_, scalar_)
!! add a scalar value to the matrix diagonal (integer).
integer(int32), intent(inout) :: matrix_(:,:)
integer(int32), 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_int32