0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_moment::average Interface Reference

Mean of vector. More...

Public Member Functions

real(sp) function average_sp (dat, mask)
 
real(dp) function average_dp (dat, mask)
 

Detailed Description

Mean of vector.

Calculates the average value of a vector, i.e. the first moment of a series of numbers:

\[ AVE = \sum_i \frac{x_i}{N} \]

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.

Example

vec = (/ 1., 2, 3., -999., 5., 6. /)
m   = average(vec, mask=(vec >= 0.))
--> m = 3.4

See also example in pf_tests directory.

Parameters
[in]real(sp/dp) :: dat(:)1D-array with input numbers
Return values
real(sp/dp) :: averageAverage of all elements in dat
Parameters
[in]logical, optional :: mask(:)1D-array of logical values with size(dat). If present, only those locations in dat corresponding to the true values in mask are used.
Note
Input values must be floating points.
Author
Matthias Cuntz
Date
Nov 2011

Definition at line 119 of file mo_moment.f90.

Member Function/Subroutine Documentation

◆ average_dp()

real(dp) function mo_moment::average::average_dp ( real(dp), dimension(:), intent(in)  dat,
logical, dimension(:), intent(in), optional  mask 
)

Definition at line 681 of file mo_moment.f90.

◆ average_sp()

real(sp) function mo_moment::average::average_sp ( real(sp), dimension(:), intent(in)  dat,
logical, dimension(:), intent(in), optional  mask 
)

Definition at line 707 of file mo_moment.f90.


The documentation for this interface was generated from the following file: