f_sts_std Function

public impure function f_sts_std(x, ddof) result(std)

Impure wrapper function for f_sts_std_core.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x(:)

x vector (assumed size array)

real(kind=wp), intent(in), optional :: ddof

delta degrees of freedom

Return Value real(kind=wp)

standard deviation


Calls

proc~~f_sts_std~~CallsGraph proc~f_sts_std f_sts_std proc~f_sts_var_core f_sts_var_core proc~f_sts_std->proc~f_sts_var_core proc~s_err_print s_err_print proc~f_sts_std->proc~s_err_print proc~f_sts_mean_core f_sts_mean_core proc~f_sts_var_core->proc~f_sts_mean_core proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c

Called by

proc~~f_sts_std~~CalledByGraph proc~f_sts_std f_sts_std interface~fsml_std fsml_std interface~fsml_std->proc~f_sts_std

Source Code

impure function f_sts_std(x, ddof) result(std)

! ==== Description
!! Impure wrapper function for `f_sts_std_core`.

! ==== Declarations
  real(wp), intent(in)           :: x(:)   !! x vector (assumed size array)
  real(wp), intent(in), optional :: ddof   !! delta degrees of freedom
  real(wp)                       :: ddof_w !! final value for ddof
  real(wp)                       :: std    !! standard deviation

! ==== Instructions

! ---- handle input

  ! assume ddof = 0 (population, not sample statistics)
  ddof_w = 0.0_wp
  if (present(ddof)) ddof_w = ddof

  ! check if value is valid
  if (ddof_w .ne. 1.0_wp .and. ddof_w .ne. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(2))
     std = c_sentinel_r
     return
  endif

  ! check if size is valid
  if (size(x) .le. 1) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(4))
     std = c_sentinel_r
     return
  endif

! ---- compute standard deviation

  ! call pure function
  std = sqrt( f_sts_var_core(x, ddof_w) )

end function f_sts_std