FORCES
FORtran lib for Comp. Env. Sys.
|
Autocorrelation function with lag k. More...
Public Member Functions | |
real(sp) function | autocorr_sp (x, k, mask) |
real(dp) function | autocorr_dp (x, k, mask) |
real(sp) function, dimension(size(k)) | autocorr_1d_sp (x, k, mask) |
real(dp) function, dimension(size(k)) | autocorr_1d_dp (x, k, mask) |
Autocorrelation function with lag k.
Element at lag k of autocorrelation function
\[ ACF(x,k) = \frac{s_{x,k}}{s_{x,0}} \]
where \( s_{x,k} \) is the autocorrelation coefficient
\[ s_{x,k} = \langle (x_i-\bar{x})(x_{i+k}-\bar{x})\rangle \]
If an optional mask is given, the calculations are 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
Autocorrelation of 0 time steps
[in] | real(sp/dp) :: x(:) | Time series. |
[in] | integer(i4) :: k[(:)] | Lag for autocorrelation. |
[in] | optional, logical :: mask(:) | 1D-array of logical values with size(vec) . If present, only those locations in vec corresponding to the true values in mask are used. |
real(sp/dp) :: ak[(:)] | Coefficient of autocorrelation function at lag k. |
Definition at line 57 of file mo_corr.f90.
real(dp) function, dimension(size(k)) mo_corr::autocorr::autocorr_1d_dp | ( | real(dp), dimension(:), intent(in) | x, |
integer(i4), dimension(:), intent(in) | k, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 141 of file mo_corr.f90.
real(sp) function, dimension(size(k)) mo_corr::autocorr::autocorr_1d_sp | ( | real(sp), dimension(:), intent(in) | x, |
integer(i4), dimension(:), intent(in) | k, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 164 of file mo_corr.f90.
real(dp) function mo_corr::autocorr::autocorr_dp | ( | real(dp), dimension(:), intent(in) | x, |
integer(i4), intent(in) | k, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 67 of file mo_corr.f90.
real(sp) function mo_corr::autocorr::autocorr_sp | ( | real(sp), dimension(:), intent(in) | x, |
integer(i4), intent(in) | k, | ||
logical, dimension(:), intent(in), optional | mask | ||
) |
Definition at line 104 of file mo_corr.f90.