Compute the mean of a 1D array
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=xp), | intent(in), | dimension(:) | :: | array | 1D array |
pure function mean(array)
!! Compute the mean of a 1D array
implicit none
real(xp), intent(in), dimension(:) :: array !! 1D array
real(xp) :: mean
mean = sum(array)/(max(1,size(array)))
return
end function mean