ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_mathFactorial.F90
Go to the documentation of this file.
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
50
52
53 use pm_kind, only: IK, RK, SK
54
55 implicit none
56
57 character(*, SK), parameter :: MODULE_NAME = "@pm_mathFactorial"
58
59!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
60
114 interface getFactorial
115
116 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
117
118#if IK5_ENABLED
119 PURE elemental module function getFactorial_IK5(n) result(factorial)
120#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
121 !DEC$ ATTRIBUTES DLLEXPORT :: getFactorial_IK5
122#endif
123 use pm_kind, only: IKG => IK5
124 integer(IKG), intent(in) :: n
125 integer(IKG) :: factorial
126 end function
127#endif
128
129#if IK4_ENABLED
130 PURE elemental module function getFactorial_IK4(n) result(factorial)
131#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
132 !DEC$ ATTRIBUTES DLLEXPORT :: getFactorial_IK4
133#endif
134 use pm_kind, only: IKG => IK4
135 integer(IKG), intent(in) :: n
136 integer(IKG) :: factorial
137 end function
138#endif
139
140#if IK3_ENABLED
141 PURE elemental module function getFactorial_IK3(n) result(factorial)
142#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
143 !DEC$ ATTRIBUTES DLLEXPORT :: getFactorial_IK3
144#endif
145 use pm_kind, only: IKG => IK3
146 integer(IKG), intent(in) :: n
147 integer(IKG) :: factorial
148 end function
149#endif
150
151#if IK2_ENABLED
152 PURE elemental module function getFactorial_IK2(n) result(factorial)
153#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
154 !DEC$ ATTRIBUTES DLLEXPORT :: getFactorial_IK2
155#endif
156 use pm_kind, only: IKG => IK2
157 integer(IKG), intent(in) :: n
158 integer(IKG) :: factorial
159 end function
160#endif
161
162#if IK1_ENABLED
163 PURE elemental module function getFactorial_IK1(n) result(factorial)
164#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
165 !DEC$ ATTRIBUTES DLLEXPORT :: getFactorial_IK1
166#endif
167 use pm_kind, only: IKG => IK1
168 integer(IKG), intent(in) :: n
169 integer(IKG) :: factorial
170 end function
171#endif
172
173 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
174
175 end interface
176
177!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
178
245
246 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
247
248#if RK5_ENABLED
249 PURE elemental module function getLogFactorial_RK5(x) result(logFactorial)
250#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
251 !DEC$ ATTRIBUTES DLLEXPORT :: getLogFactorial_RK5
252#endif
253 use pm_kind, only: RKG => RK5
254 real(RKG) , intent(in) :: x
255 real(RKG) :: logFactorial
256 end function
257#endif
258
259#if RK4_ENABLED
260 PURE elemental module function getLogFactorial_RK4(x) result(logFactorial)
261#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
262 !DEC$ ATTRIBUTES DLLEXPORT :: getLogFactorial_RK4
263#endif
264 use pm_kind, only: RKG => RK4
265 real(RKG) , intent(in) :: x
266 real(RKG) :: logFactorial
267 end function
268#endif
269
270#if RK3_ENABLED
271 PURE elemental module function getLogFactorial_RK3(x) result(logFactorial)
272#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
273 !DEC$ ATTRIBUTES DLLEXPORT :: getLogFactorial_RK3
274#endif
275 use pm_kind, only: RKG => RK3
276 real(RKG) , intent(in) :: x
277 real(RKG) :: logFactorial
278 end function
279#endif
280
281#if RK2_ENABLED
282 PURE elemental module function getLogFactorial_RK2(x) result(logFactorial)
283#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
284 !DEC$ ATTRIBUTES DLLEXPORT :: getLogFactorial_RK2
285#endif
286 use pm_kind, only: RKG => RK2
287 real(RKG) , intent(in) :: x
288 real(RKG) :: logFactorial
289 end function
290#endif
291
292#if RK1_ENABLED
293 PURE elemental module function getLogFactorial_RK1(x) result(logFactorial)
294#if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
295 !DEC$ ATTRIBUTES DLLEXPORT :: getLogFactorial_RK1
296#endif
297 use pm_kind, only: RKG => RK1
298 real(RKG) , intent(in) :: x
299 real(RKG) :: logFactorial
300 end function
301#endif
302
303 !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
304
305 end interface
306
307!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
308
309end module pm_mathFactorial ! LCOV_EXCL_LINE
Generate and return the factorial of the input positive integer.
Generate and return the natural logarithm of the factorial of the input positive whole real number.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
integer, parameter IK3
Definition: pm_kind.F90:368
integer, parameter RK5
Definition: pm_kind.F90:478
integer, parameter RK4
Definition: pm_kind.F90:489
integer, parameter IK1
Definition: pm_kind.F90:382
integer, parameter RK2
Definition: pm_kind.F90:511
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
Definition: pm_kind.F90:543
integer, parameter RK3
Definition: pm_kind.F90:500
integer, parameter IK2
Definition: pm_kind.F90:375
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
Definition: pm_kind.F90:540
integer, parameter IK4
Definition: pm_kind.F90:361
integer, parameter IK5
Definition: pm_kind.F90:354
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
integer, parameter RK1
Definition: pm_kind.F90:522
This module contains procedures and generic interfaces for the Factorial function.
character(*, SK), parameter MODULE_NAME