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 procedure implementations of [pm_mathLog1p](@ref pm_mathLog1p).
19 : !>
20 : !> \finmain
21 : !>
22 : !> \author
23 : !> \AmirShahmoradi, Thursday 1:45 AM, August 22, 2019, Dallas, TX
24 :
25 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 :
27 : #if Seq_ENABLED && CK_ENABLED
28 : complex(CKC) :: y, z
29 : #elif Seq_ENABLED && RK_ENABLED
30 : real(RKC) :: y, z
31 : !#elif Sel_ENABLED && CK_ENABLED
32 : ! use pm_complexCompareAll, only: operator(<)
33 : ! complex(CKC) :: absX
34 : !#elif Sel_ENABLED && RK_ENABLED
35 : ! real(RKC) :: absX
36 : #else
37 : #error "Unrecognized interface."
38 : #endif
39 : #if CK_ENABLED
40 : complex(CKC), parameter :: ONE = cmplx(1._CKC, 0._CKC, CKC)
41 : complex(CKC), parameter :: ZERO = cmplx(0._CKC, 0._CKC, CKC)
42 : complex(CKC), parameter :: EPSX = cmplx(epsilon(0._CKC), epsilon(0._CKC), CKC)
43 : complex(CKC), parameter :: TINYX = cmplx(tiny(0._CKC), tiny(0._CKC), CKC)
44 : !#define GET_REAL(x) x%re
45 : #elif RK_ENABLED
46 : real(RKC) , parameter :: ONE = 1._RKC, ZERO = 0._RKC, EPSX = epsilon(x), TINYX = tiny(x)
47 : !#define GET_REAL(x) x
48 : #else
49 : #error "Unrecognized interface."
50 : #endif
51 : integer , parameter :: TKC = kind(x) ! This kind current.
52 8 : CHECK_ASSERTION(__LINE__, real(x, TKC) > -1._TKC, SK_"@getLog1p(): The condition `real(x) > -1.` must hold. x = "//getStr(x))
53 8 : CHECK_ASSERTION(__LINE__, real(x, TKC) < huge(0._TKC), SK_"@getLog1p(): The condition `real(x) <= huge(x)` must hold. x = "//getStr(x))
54 : #if Seq_ENABLED
55 8 : y = ONE + x
56 8 : z = y - ONE
57 8 : log1p = log(y) - (z - x) / y
58 : !#elif Sel_ENABLED
59 : ! !absRealX = abs(GET_REAL(x))
60 : ! absX = abs(x)
61 : ! ! Is this really needed? any number smaller than tiny? Yes: zero
62 : ! ! if (absRealX < tiny(0._TKC)) then
63 : ! if (absX < TINYX) then
64 : ! log1p = ZERO
65 : ! !elseif (absRealX < epsilon(0._TKC)) then
66 : ! elseif (absX < EPSX) then
67 : ! log1p = getLog1p(x)
68 : ! else
69 : ! log1p = log(ONE + x)
70 : ! end if
71 : #else
72 : #error "Unrecognized interface."
73 : #endif
74 :
75 : !#undef GET_REAL
|