An easy to follow library to make Fortran easier in general with wrapped interfaces, sorting routines, kD-Trees, and other algorithms to handle scientific data and concepts. The library contains core fortran routines and object-oriented classes.
There are typos and illegal names in the native Fortran version of the mean which do not allow it to compile.
Below is the correct code:
program theMean_program
use, intrinsic :: iso_fortran_env, only: real64, int32
implicit none
real(real64), allocatable :: a(:)
real(real64) :: theMean
! Some parameters to handle everything
integer(int32) :: i, istat, N
N=1000
! Allocate a and check for errors
allocate(a(N), stat=istat)
if (istat /= 0) then
stop "Could not allocate a"
endif
! Create numbers from 1 to N
a = [(real(i,kind=real64), i=1,N)]
! Compute the mean
theMean = sum(a)/real(N,kind=real64)
! Deallocate memory
deallocate(a, stat=istat)
if (istat /= 0) then
stop "Could not deallocate a"
endif
end program
There are typos and illegal names in the native Fortran version of the mean which do not allow it to compile.
Below is the correct code:
(I did not test the coretran variant)