f_dst_llogistic_pdf Function

public impure function f_dst_llogistic_pdf(x, alpha, beta, loc) result(fx)

Impure wrapper function for f_dst_llogistic_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), optional :: alpha

distribution log-scale

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

distribution shape

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

distribution log-location

Return Value real(kind=wp)


Calls

proc~~f_dst_llogistic_pdf~~CallsGraph proc~f_dst_llogistic_pdf f_dst_llogistic_pdf proc~f_dst_llogistic_pdf_core f_dst_llogistic_pdf_core proc~f_dst_llogistic_pdf->proc~f_dst_llogistic_pdf_core proc~f_utl_assign_nan f_utl_assign_nan proc~f_dst_llogistic_pdf->proc~f_utl_assign_nan proc~s_err_print s_err_print proc~f_dst_llogistic_pdf->proc~s_err_print

Called by

proc~~f_dst_llogistic_pdf~~CalledByGraph proc~f_dst_llogistic_pdf f_dst_llogistic_pdf interface~fsml_llogistic_pdf fsml_llogistic_pdf interface~fsml_llogistic_pdf->proc~f_dst_llogistic_pdf

Source Code

impure function f_dst_llogistic_pdf(x, alpha, beta, loc) result(fx)

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

! ==== Declarations
  real(wp), intent(in)           :: x       !! sample position
  real(wp), intent(in), optional :: alpha   !! distribution log-scale
  real(wp), intent(in), optional :: beta    !! distribution shape
  real(wp), intent(in), optional :: loc     !! distribution log-location
  real(wp)                       :: loc_w   !! final value for loc
  real(wp)                       :: alpha_w !! final value for alpha
  real(wp)                       :: beta_w  !! final value for beta
  real(wp)                       :: fx

! ==== Instructions

! ---- handle input

  ! assume alpha = 1, overwrite if specified
  alpha_w = 1.0_wp
  if (present(alpha)) alpha_w = alpha

  ! assume shape = 1, overwrite if specified
  beta_w = 1.0_wp
  if (present(beta)) beta_w = beta

  ! assume log-location = 0, overwrite if specified
  loc_w = 0.0_wp
  if (present(loc)) loc_w = loc

  ! check if alpha and shape values are valid
  if (alpha_w .le. 0.0_wp .or. beta_w .le. 0.0_wp) then
     call s_err_print(fsml_error(1))
     fx = f_utl_assign_nan()
     return
  endif

  ! check if x value is valid (support x > 0)
  if (x .le. 0.0_wp) then
     fx = 0.0_wp
     return
  endif

! ---- compute PDF

  ! call pure function to calculate probability/fx
  fx = f_dst_llogistic_pdf_core(x, alpha_w, beta_w, loc_w)

end function f_dst_llogistic_pdf