Line | |
---|
1 | MODULE diagadd_m |
---|
2 | |
---|
3 | IMPLICIT NONE |
---|
4 | |
---|
5 | INTERFACE diagadd |
---|
6 | MODULE PROCEDURE diagadd_rv,diagadd_r |
---|
7 | END INTERFACE |
---|
8 | |
---|
9 | private diagadd_rv,diagadd_r |
---|
10 | |
---|
11 | CONTAINS |
---|
12 | |
---|
13 | SUBROUTINE diagadd_rv(mat,diag) |
---|
14 | use assert_eq_m, only: assert_eq |
---|
15 | REAL, DIMENSION(:,:), INTENT(INOUT) :: mat |
---|
16 | REAL, DIMENSION(:), INTENT(IN) :: diag |
---|
17 | INTEGER :: j,n |
---|
18 | n = assert_eq(size(diag),min(size(mat,1),size(mat,2)),'diagadd_rv') |
---|
19 | do j=1,n |
---|
20 | mat(j,j)=mat(j,j)+diag(j) |
---|
21 | end do |
---|
22 | END SUBROUTINE diagadd_rv |
---|
23 | !BL |
---|
24 | SUBROUTINE diagadd_r(mat,diag) |
---|
25 | REAL, DIMENSION(:,:), INTENT(INOUT) :: mat |
---|
26 | REAL, INTENT(IN) :: diag |
---|
27 | INTEGER :: j,n |
---|
28 | n = min(size(mat,1),size(mat,2)) |
---|
29 | do j=1,n |
---|
30 | mat(j,j)=mat(j,j)+diag |
---|
31 | end do |
---|
32 | END SUBROUTINE diagadd_r |
---|
33 | |
---|
34 | END MODULE diagadd_m |
---|
Note: See
TracBrowser
for help on using the repository browser.