FORCES
FORtran lib for Comp. Env. Sys.
|
Standard deviation of a vector. More...
Public Member Functions | |
real(sp) function | variance_sp (dat, mask) |
real(dp) function | variance_dp (dat, mask) |
Standard deviation of a vector.
Calculates the sample variance of a vector, i.e. the second moment
\[\sigma_x^2 = \sum_i\frac{(x_i-\bar x)^2}{N-1}\]
If an optional mask is given, the average is only 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.
[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) :: variance | Sample variance of all elements in dat. |
var = variance * (n-1)/n
Definition at line 604 of file mo_moment.f90.
real(dp) function mo_moment::variance::variance_dp | ( | real(dp), dimension(:), intent(in) | dat, |
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 1673 of file mo_moment.f90.
real(sp) function mo_moment::variance::variance_sp | ( | real(sp), dimension(:), intent(in) | dat, |
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 1709 of file mo_moment.f90.