FORCES
FORtran lib for Comp. Env. Sys.
|
Mean absolute deviation from mean. More...
Public Member Functions | |
real(sp) function | absdev_sp (dat, mask) |
real(dp) function | absdev_dp (dat, mask) |
Mean absolute deviation from mean.
Calculates the mean absolute deviations from the mean
\[ ABSDEV = \sum_i\frac{|x_i-\bar x|}{N} \]
If an optinal mask is given, the calculations are over those locations that correspond to true values in the mask. \( x\) can be single or double precision. The result will have the same numerical precision.
Example
vec = (/ 1., 2, 3., -999., 5., 6. /) m = absdev(vec, mask=(vec >= 0.))
See also example in pf_tests directory.
[in] | real(sp/dp) :: dat(:) | 1D-array with input numbers. |
[in] | logical, optional :: mask(:) | 1D-array of logical values with size(dat) . If present, only those locations in vec corresponding to the true values in mask are used. |
real(sp/dp) :: absdev | Mean absolute deviations from average. |
Definition at line 79 of file mo_moment.f90.
real(dp) function mo_moment::absdev::absdev_dp | ( | real(dp), dimension(:), intent(in) | dat, |
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 618 of file mo_moment.f90.
real(sp) function mo_moment::absdev::absdev_sp | ( | real(sp), dimension(:), intent(in) | dat, |
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 649 of file mo_moment.f90.