https://www.cdslab.org/paramonte/fortran/2
Current view: top level - main - pm_distCosRaised@routines.inc.F90 (source / functions) Hit Total Coverage
Test: ParaMonte 2.0.0 :: Serial Fortran - Code Coverage Report Lines: 23 23 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_distCosRaised](@ref pm_distCosRaised).
      19             : !>
      20             : !>  \author
      21             : !>  \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
      22             : 
      23             : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      24             : 
      25             :         !%%%%%%%%%%%%%%%%%%%%%%
      26             : #if     getCosRaisedPDF_ENABLED
      27             :         !%%%%%%%%%%%%%%%%%%%%%%
      28             : 
      29        1349 :         if (present(mu) .and. present(sigma)) then
      30        1341 :             call setCosRaisedPDF(pdf, x, mu, 1._TKC / sigma)
      31           8 :         elseif (present(sigma)) then
      32           1 :             call setCosRaisedPDF(pdf, x, 0._TKC, 1._TKC / sigma)
      33           7 :         elseif (present(mu)) then
      34           1 :             call setCosRaisedPDF(pdf, x, mu)
      35             :         else
      36           6 :             call setCosRaisedPDF(pdf, x)
      37             :         end if
      38             : 
      39             :         !%%%%%%%%%%%%%%%%%%%%%%
      40             : #elif   setCosRaisedPDF_ENABLED
      41             :         !%%%%%%%%%%%%%%%%%%%%%%
      42             : 
      43             :         real(TKC), parameter :: PI = acos(-1._TKC)
      44             : #if     XMD_ENABLED || XDD_ENABLED
      45             :         real(TKC), parameter :: invSigma = 1._TKC
      46             : #if     XDD_ENABLED
      47             :         real(TKC), parameter :: mu = 0._TKC
      48             : #endif
      49             : #elif   XMI_ENABLED
      50        2683 :         CHECK_ASSERTION(__LINE__, 0._TKC < invSigma, SK_"@setCosRaisedPDF(): The condition `0. < invSigma` must hold. invSigma = "//getStr(invSigma))
      51             : #else
      52             : #error  "Unrecognized interface."
      53             : #endif
      54       10788 :         CHECK_ASSERTION(__LINE__, x <= mu + 1._TKC / invSigma, SK_"@getCosRaisedPDF(): The condition `x <= mu + 1. / invSigma` must hold. x, mu, invSigma = "//getStr([x, mu, invSigma]))
      55       10788 :         CHECK_ASSERTION(__LINE__, x >= mu - 1._TKC / invSigma, SK_"@getCosRaisedPDF(): The condition `x >= mu - 1. / invSigma` must hold. x, mu, invSigma = "//getStr([x, mu, invSigma]))
      56        2697 :         pdf = 0.5_TKC * invSigma * (1._TKC + cos(PI * invSigma * (x - mu)))
      57             : 
      58             :         !%%%%%%%%%%%%%%%%%%%%%%
      59             : #elif   getCosRaisedCDF_ENABLED
      60             :         !%%%%%%%%%%%%%%%%%%%%%%
      61             : 
      62        1349 :         if (present(mu) .and. present(sigma)) then
      63        1341 :             call setCosRaisedCDF(cdf, x, mu, 1._TKC / sigma)
      64           8 :         elseif (present(sigma)) then
      65           1 :             call setCosRaisedCDF(cdf, x, 0._TKC, 1._TKC / sigma)
      66           7 :         elseif (present(mu)) then
      67           1 :             call setCosRaisedCDF(cdf, x, mu)
      68             :         else
      69           6 :             call setCosRaisedCDF(cdf, x)
      70             :         end if
      71             : 
      72             :         !%%%%%%%%%%%%%%%%%%%%%%
      73             : #elif   setCosRaisedCDF_ENABLED
      74             :         !%%%%%%%%%%%%%%%%%%%%%%
      75             : 
      76             :         real(TKC) :: stanx
      77             :         real(TKC), parameter :: PI = acos(-1._TKC)
      78             :         real(TKC), parameter :: INV_PI = 1._TKC / PI
      79             : #if     XMD_ENABLED || XDD_ENABLED
      80             :         real(TKC), parameter :: invSigma = 1._TKC
      81             : #if     XDD_ENABLED
      82             :         real(TKC), parameter :: mu = 0._TKC
      83             : #endif
      84             : #elif   XMI_ENABLED
      85        2683 :         CHECK_ASSERTION(__LINE__, 0._TKC < invSigma, SK_"@setCosRaisedCDF(): The condition `0. < invSigma` must hold. invSigma = "//getStr(invSigma))
      86             : #else
      87             : #error  "Unrecognized interface."
      88             : #endif
      89       10788 :         CHECK_ASSERTION(__LINE__, x <= mu + 1._TKC / invSigma, SK_"@getCosRaisedCDF(): The condition `x <= mu + 1. / invSigma` must hold. x, mu, invSigma = "//getStr([x, mu, invSigma]))
      90       10788 :         CHECK_ASSERTION(__LINE__, x >= mu - 1._TKC / invSigma, SK_"@getCosRaisedCDF(): The condition `x >= mu - 1. / invSigma` must hold. x, mu, invSigma = "//getStr([x, mu, invSigma]))
      91        2697 :         stanx = (x - mu) * invSigma
      92        2697 :         cdf = 0.5_TKC * (1._TKC + stanx + sin(stanx * PI) * INV_PI)
      93             : #else
      94             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      95             : #error  "Unrecognized interface."
      96             :         !%%%%%%%%%%%%%%%%%%%%%%%%
      97             : #endif

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