Impure wrapper function for f_sts_cov_core.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
x vector (assumed size array) |
||
| real(kind=wp), | intent(in) | :: | y(:) |
y vector (assumed size array) |
||
| real(kind=wp), | intent(in), | optional | :: | ddf |
delta degrees of freedom |
covariance
impure function f_sts_cov(x, y, ddf) result(cov) ! ==== Description !! Impure wrapper function for `f_sts_cov_core`. ! ==== Declarations real(wp), intent(in) :: x(:) !! x vector (assumed size array) real(wp), intent(in) :: y(:) !! y vector (assumed size array) real(wp), intent(in), optional :: ddf !! delta degrees of freedom real(wp) :: ddf_w !! final value for ddf real(wp) :: xbar !! mean of x real(wp) :: ybar !! mean of y real(wp) :: cov !! covariance ! ==== Instructions ! ---- handle input ! assume ddf = 0 (population, not sample statistics) ddf_w = 0.0_wp if (present(ddf)) ddf_w = ddf ! check if value is valid if (ddf_w .ne. 1.0_wp .and. ddf_w .ne. 0.0_wp) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(2)) cov = f_utl_assign_nan() return endif ! check if size is valid if (size(x) .le. 1) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(4)) cov = f_utl_assign_nan() return endif ! check if x and y have same size if (size(x) .ne. size(y)) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(4)) cov = f_utl_assign_nan() return endif ! ---- compute covariance ! call pure function cov = f_sts_cov_core(x, y, ddf_w) end function f_sts_cov