Impure wrapper for f_sts_quantile_core.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=wp), | intent(in) | :: | x(:) |
data vector (assumed size array) |
||
| real(kind=wp), | intent(in) | :: | p |
desired percentile |
quantile value
impure function f_sts_quantile(x, p) result(q) ! ==== Description !! Impure wrapper for `f_sts_quantile_core`. ! ==== Declarations real(wp) , intent(in) :: x(:) !! data vector (assumed size array) real(wp) , intent(in) :: p !! desired percentile real(wp) :: q !! quantile value ! ==== Instructions ! ---- handle input ! 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)) q = f_utl_assign_nan() return endif ! check if p value is valid if (p .gt. 1.0_wp .or. p .lt. 0.0_wp) then ! write error message and assign NaN value if invalid call s_err_print(fsml_error(1)) q = f_utl_assign_nan() return endif ! ---- compute quantile value ! call pure function q = f_sts_quantile_core(x, p) end function f_sts_quantile