f_dst_t_pdf Function

public impure function f_dst_t_pdf(x, df, mu, sigma) result(fx)

Impure wrapper function for f_dst_t_pdf_core. Handles optional arguments and invalid values for arguments.

Arguments

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

sample position

real(kind=wp), intent(in) :: df

degrees of freedom

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

distribution location (~mean)

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

distribution dispersion/scale (~standard deviation)

Return Value real(kind=wp)


Calls

proc~~f_dst_t_pdf~~CallsGraph proc~f_dst_t_pdf f_dst_t_pdf proc~f_dst_t_pdf_core f_dst_t_pdf_core proc~f_dst_t_pdf->proc~f_dst_t_pdf_core proc~s_err_print s_err_print proc~f_dst_t_pdf->proc~s_err_print proc~f_utl_r2c f_utl_r2c proc~s_err_print->proc~f_utl_r2c

Called by

proc~~f_dst_t_pdf~~CalledByGraph proc~f_dst_t_pdf f_dst_t_pdf interface~fsml_t_pdf fsml_t_pdf interface~fsml_t_pdf->proc~f_dst_t_pdf

Source Code

impure function f_dst_t_pdf(x, df, mu, sigma) result(fx)

! ==== Description
!! Impure wrapper function for `f_dst_t_pdf_core`.
!! Handles optional arguments and invalid values for arguments.

! ==== Declarations
  real(wp), intent(in)           :: x       !! sample position
  real(wp), intent(in)           :: df      !! degrees of freedom
  real(wp), intent(in), optional :: mu      !! distribution location (~mean)
  real(wp), intent(in), optional :: sigma   !! distribution dispersion/scale (~standard deviation)
  real(wp)                       :: mu_w    !! final value of mu
  real(wp)                       :: sigma_w !! final value of sigma
  real(wp)                       :: fx

! ==== Instructions

! ---- handle input

  ! assume location/mean = 0, overwrite if specified
  mu_w = 0.0_wp
  if (present(mu)) mu_w = mu

  ! assume sigma = 1, overwrite if specified
  sigma_w = 1.0_wp
  if (present(sigma)) sigma_w = sigma

  ! check if sigma value is valid
  if (sigma_w .le. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(1))
     fx = c_sentinel_r
     return
  endif

  ! check if degrees of freedom value is valid
  if (df .le. 0.0_wp) then
     ! write error message and assign sentinel value if invalid
     call s_err_print(fsml_error(1))
     fx = c_sentinel_r
     return
  endif

! ---- compute PDF

  ! call pure function to calculate probability/fx
  fx = f_dst_t_pdf_core(x, df, mu_w, sigma_w)

end function f_dst_t_pdf