f_dst_exp_pdf Function

public impure function f_dst_exp_pdf(x, lambda, loc) result(fx)

Impure wrapper function for f_dst_exp_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 :: lambda

lambda parameter, beta(scale) = 1/lambda = mu/mean

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

location parameter

Return Value real(kind=wp)


Calls

proc~~f_dst_exp_pdf~~CallsGraph proc~f_dst_exp_pdf f_dst_exp_pdf proc~f_dst_exp_pdf_core f_dst_exp_pdf_core proc~f_dst_exp_pdf->proc~f_dst_exp_pdf_core proc~s_err_print s_err_print proc~f_dst_exp_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_exp_pdf~~CalledByGraph proc~f_dst_exp_pdf f_dst_exp_pdf interface~fsml_exp_pdf fsml_exp_pdf interface~fsml_exp_pdf->proc~f_dst_exp_pdf

Source Code

impure function f_dst_exp_pdf(x, lambda, loc) result(fx)

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

! ==== Declarations
  real(wp), intent(in)           :: x        !! sample position
  real(wp), intent(in), optional :: loc      !! location parameter
  real(wp), intent(in), optional :: lambda   !! lambda parameter, beta(scale) = 1/lambda = mu/mean
  real(wp)                       :: loc_w    !! final value for loc
  real(wp)                       :: lambda_w !! final value for lambda
  real(wp)                       :: fx

! ==== Instructions

! ---- handle input

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

  ! assume lambda = 1, overwrite if specified
  lambda_w = 1.0_wp
  if (present(lambda)) lambda_w = lambda

  ! check if lambda value is valid
  if (lambda_w .le. 0.0_wp) then
     ! write error message and assign sentinel value if value 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_exp_pdf_core(x, lambda_w, loc_w)

end function f_dst_exp_pdf