https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_distExpGamma@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 21 21 100.0 %
Date: 2024-04-08 03:18:57 Functions: 0 0 -
Legend: Lines: hit not hit

          Line data    Source code
       1             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       2             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       3             : !!!!                                                                                                                            !!!!
       4             : !!!!    ParaMonte: Parallel Monte Carlo and Machine Learning Library.                                                           !!!!
       5             : !!!!                                                                                                                            !!!!
       6             : !!!!    Copyright (C) 2012-present, The Computational Data Science Lab                                                          !!!!
       7             : !!!!                                                                                                                            !!!!
       8             : !!!!    This file is part of the ParaMonte library.                                                                             !!!!
       9             : !!!!                                                                                                                            !!!!
      10             : !!!!    LICENSE                                                                                                                 !!!!
      11             : !!!!                                                                                                                            !!!!
      12             : !!!!       https://github.com/cdslaborg/paramonte/blob/main/LICENSE.md                                                          !!!!
      13             : !!!!                                                                                                                            !!!!
      14             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      15             : !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
      16             : 
      17             : !>  \brief
      18             : !>  This include file contains the implementation of procedures in [pm_distExpGamma](@ref pm_distExpGamma).
      19             : !>
      20             : !>  \author
      21             : !>  \AmirShahmoradi, Oct 16, 2009, 12:20 PM, Michigan
      22             : 
      23             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      24             : 
      25             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%
      26             : #if     getExpGammaLogPDFNF_ENABLED
      27             :         !%%%%%%%%%%%%%%%%%%%%%%%%%%
      28             : 
      29        7039 :         CHECK_ASSERTION(__LINE__, kappa > 0._RKC, SK_"@getExpGammaLogPDFNF(): The condition `kappa > 0.` must hold. kappa = "//getStr(kappa))
      30        7039 :         logPDFNF = -log_gamma(kappa)
      31             : 
      32             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      33             : #elif   getExpGammaLogPDF_ENABLED
      34             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      35             : 
      36             :         real(RKC) :: kappa_def, logSigma_def
      37        6013 :         kappa_def = 1._RKC; if (present(kappa)) kappa_def = kappa
      38        6013 :         logSigma_def = 0._RKC; if (present(logSigma)) logSigma_def = logSigma
      39        6013 :         call setExpGammaLogPDF(logPDF, x, getExpGammaLogPDFNF(kappa_def), kappa_def, logSigma_def)
      40             : 
      41             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      42             : #elif   setExpGammaLogPDF_ENABLED
      43             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      44             : 
      45             : #if     DDD_ENABLED
      46           1 :         logPDF = x - exp(x)
      47             : #elif   NKD_ENABLED
      48       12026 :         CHECK_ASSERTION(__LINE__, 0._RKC < kappa, SK_"@getExpGammaLogPDFNF(): The condition `0. < kappa` must hold. kappa = "//getStr(kappa))
      49       12026 :         logPDF = logPDFNF + kappa * x - exp(x)
      50             : #elif   NKS_ENABLED
      51       12014 :         call setExpGammaLogPDF(logPDF, x - logSigma, logPDFNF, kappa)
      52             : #else
      53             : #error  "Unrecognized interface."
      54             : #endif
      55             : 
      56             :         !%%%%%%%%%%%%%%%%%%%%%
      57             : #elif   getExpGammaCDF_ENABLED
      58             :         !%%%%%%%%%%%%%%%%%%%%%
      59             : 
      60             :         integer(IK) :: info
      61             :         real(RKC)   :: xnormed
      62        6014 :         if (present(logSigma)) then
      63        6001 :             xnormed = x - logSigma
      64             :         else
      65          13 :             xnormed = x
      66             :         end if
      67        6014 :         if (present(kappa)) then
      68        6013 :             call setExpGammaCDF(cdf, xnormed, log_gamma(kappa), kappa, info)
      69             :         else
      70           1 :             call setExpGammaCDF(cdf, xnormed, info)
      71             :         end if
      72        6014 :         if (info < 0_IK) error stop MODULE_NAME//SK_"@getExpGammaCDF(): The computation of the regularized Lower Incomplete Gamma function failed. This can happen if `kappa` is too large."
      73             : 
      74             :         !%%%%%%%%%%%%%%%%%%%%%
      75             : #elif   setExpGammaCDF_ENABLED
      76             :         !%%%%%%%%%%%%%%%%%%%%%
      77             : 
      78             : #if     DD_ENABLED
      79             :         real(RKC), parameter :: kappa = 1._RKC, logGammaKappa = log_gamma(kappa)
      80           2 :         call setGammaIncLow(cdf, exp(x), logGammaKappa, kappa, info)
      81             : #else
      82       12026 :         CHECK_ASSERTION(__LINE__, kappa > 0._RKC, SK_"@setExpGammaCDF(): The condition `kappa > 0.` must hold. kappa = "//getStr(kappa)) ! fpp
      83       36078 :         CHECK_ASSERTION(__LINE__, abs(log_gamma(kappa) - logGammaKappa) < 100 * epsilon(0._RKC), \
      84             :         SK_"@setExpGammaCDF(): The condition `abs(log_gamma(kappa) - logGammaKappa) < 100 * epsilon(0._RKC)` must hold. log_gamma(kappa), logGammaKappa = "//\
      85             :         getStr([log_gamma(kappa), logGammaKappa])) ! fpp
      86             : #if     KD_ENABLED
      87        6025 :         call setGammaIncLow(cdf, exp(x), logGammaKappa, kappa, info)
      88             : #elif   KS_ENABLED
      89        6001 :         call setGammaIncLow(cdf, exp(x - logSigma), logGammaKappa, kappa, info)
      90             : #else
      91             : #error  "Unrecognized interface."
      92             : #endif
      93             : #endif
      94             : 
      95             : #else
      96             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      97             : #error  "Unrecognized interface."
      98             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      99             : #endif

ParaMonte: Parallel Monte Carlo and Machine Learning Library 
The Computational Data Science Lab
© Copyright 2012 - 2024