file_to_wrap2.f90 504 Bytes
Newer Older
Loic Huder's avatar
Loic Huder committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
subroutine sum_squares(A, res)
    implicit none
    real, dimension(:), intent(in) :: A
    real, intent(out) :: res
    integer :: i, N

    N = size(A)
    res = 0.

    do i=1, N
        res = res + A(i)*A(i)
    end do

end subroutine


real function sum_squares_as_func(A)
    implicit none
    real, dimension(:), intent(in) :: A
    integer :: i, N

    N = size(A)
    sum_squares_as_func = 0.

    do i=1, N
        sum_squares_as_func = sum_squares_as_func + A(i)*A(i)
    end do

end function