FORCES
FORtran lib for Comp. Env. Sys.
|
R-s mixed central moment between vectors. More...
Public Member Functions | |
real(sp) function | mixed_central_moment_sp (x, y, r, s, mask) |
real(dp) function | mixed_central_moment_dp (x, y, r, s, mask) |
R-s mixed central moment between vectors.
Calculates the r,s-th mixed central moment between two vectors:
\[\mu_{r-s} = \sum_i\frac{(x_i-\bar{x})^r(y_i-\bar{y})^s}{N}\]
Note that covariace(x,y) = mixed_central_moment(x,y,1,1)
If an optinal 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
vec1 = (/ 1., 2, 3., -999., 5., 6. /) vec2 = (/ 1.3, 2.7, 3.9, 5.1, 6., 8. /) m = mixed_central_moment(vec1, vec2, 2, 2, mask=((vec1 >= 0.) .and. (vec2 >= 0.)))
See also example in test directory.
Literature
[in] | real(sp/dp) :: x(:) | First 1D-array |
[in] | real(sp/dp) :: y(:) | Second 1D-array |
[in] | integer(i4) :: r | Order of x |
[in] | integer(i4) :: s | Order of y |
[in] | logical, optional :: mask(:) | 1D-array of logical values with size(x). If present, only those locations in dat corresponding to the true values in mask are used. |
real(sp/dp) :: mixed_central_moment | r,s-th mixed central moment between x and y |
Definition at line 401 of file mo_moment.f90.
real(dp) function mo_moment::mixed_central_moment::mixed_central_moment_dp | ( | real(dp), dimension(:), intent(in) | x, |
real(dp), dimension(:), intent(in) | y, | ||
integer(i4), intent(in) | r, | ||
integer(i4), intent(in) | s, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 1164 of file mo_moment.f90.
real(sp) function mo_moment::mixed_central_moment::mixed_central_moment_sp | ( | real(sp), dimension(:), intent(in) | x, |
real(sp), dimension(:), intent(in) | y, | ||
integer(i4), intent(in) | r, | ||
integer(i4), intent(in) | s, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 1214 of file mo_moment.f90.