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 module contains a collection of interesting or challenging integrands
19 : !> for testing or examining the integration routines of the ParaMonte library.<br>
20 : !>
21 : !> \details
22 : !> The routines to be tested include but are not limited to those of<br>
23 : !> <ul>
24 : !> <li> [pm_quadPack](@ref pm_quadPack)<br>
25 : !> <li> [pm_quadRomb](@ref pm_quadRomb)<br>
26 : !> </ul>
27 : !>
28 : !> All test integrands are wrapped in a derived type of the base
29 : !> abstract class [integrand_type](@ref pm_quadTest::integrand_type).<br>
30 : !>
31 : !> \see
32 : !> [pm_quadPack](@ref pm_quadPack)<br>
33 : !> [pm_quadRomb](@ref pm_quadRomb)<br>
34 : !>
35 : !> \todo
36 : !> \pvhigh
37 : !> Unfortunately, gfortran 12 and older versions do not properly support the parameterized derived types (PDTs).<br>
38 : !> As such, the example generic-real-kind PDT types could not be used here.<br>
39 : !> This creates significant complexities when using the examples of these modules,<br>
40 : !> because all `real` kinds in this module are set to the highest precision available.<br>
41 : !> The onus is then on the end user to write wrappers that convert the relevant components and function-returns to the desired `real` kinds.<br>
42 : !> In addition to being ugly, error-prone and verbose, this usage of the highest-precision `real` kind is also highly inefficient computationally.<br>
43 : !> Fortunately, once PDTs are supported in gfortran, the conversion of the example types of this module to PDTs is straightforward and non-breaking.<br>
44 : !> The migration to PDTs must be done as soon as gfortran supports for PDTs is complete.<br>
45 : !> Note that other compilers have full support of PDTs.<br>
46 : !>
47 : !> \finmain
48 : !>
49 : !> \author
50 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
51 :
52 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 :
54 : module pm_quadTest
55 :
56 : use pm_kind, only: SK, IK, LK, RKH
57 : use pm_str, only: getTTZ => getTrimmedTZ
58 : use pm_quadPack, only: wcauchy_type
59 : use pm_option, only: getOption
60 : use pm_val2str, only: getStr
61 :
62 : implicit none
63 :
64 : character(*, SK), parameter :: MODULE_NAME = "@pm_quadTest"
65 :
66 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
67 :
68 : !> \brief
69 : !> This is the base type `integrand_type` standing `abstract` integrand type to generate a variety of integration test functions.<br>
70 : !>
71 : !> \details
72 : !> The abstract type minimally contains:<br>
73 : !> <ol>
74 : !> <li> The integration limits and deferred type-bound procedure `get()`.<br>
75 : !> <li> The locations of points of difficulties within the domain of integration
76 : !> (other than those that appear in function weights such as Cauchy types of singularities).<br>
77 : !> <li> Information about the Cauchy type singularity and Cauchy weight of the function.<br>
78 : !> The Cauchy weight has the form,<br>
79 : !> \f{equation}{
80 : !> w(x) = \frac{1}{x - c}
81 : !> \f}
82 : !> </ol>
83 : !> It is primarily meant to be used internally within the ParaMonte library for testing and illustration purposes.<br>
84 : !> In particular, the implementations may not be ideal for benchmarks and performance tests of the library integrators.<br>
85 : !> Nevertheless, all relevant types and integration test objects are `public` in this repository and available to the end user.<br>
86 : !>
87 : !> \interface{integrand_type}
88 : !> \code{.F90}
89 : !>
90 : !> use pm_quadTest, only: integrand_type
91 : !>
92 : !> type, extends(integrand_type) :: myint_type
93 : !> ...
94 : !> end type
95 : !>
96 : !> \endcode
97 : !>
98 : !> \see
99 : !> [getQuadErr](@ref pm_quadPack::getQuadErr)<br>
100 : !>
101 : !> \test
102 : !> [test_pm_quadPack](@ref test_pm_quadPack)
103 : !>
104 : !> \finmain{integrand_type}
105 : !>
106 : !> \author
107 : !> \AmirShahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin
108 : type, abstract :: integrand_type
109 : real(RKH) :: lb !< \public The scalar of type `real` of the highest kind supported by the library \RKH, containing the lower limit of integration.
110 : real(RKH) :: ub !< \public The scalar of type `real` of the highest kind supported by the library \RKH, containing the upper limit of integration.
111 : real(RKH) :: integral !< \public The scalar of type `real` of the highest kind supported by the library \RKH, containing the true result of integration.
112 : real(RKH) , allocatable :: break(:) !< \public The scalar of type `real` of the highest kind supported by the library \RKH, containing the points of difficulties of integration.
113 : type(wcauchy_type) , allocatable :: wcauchy !< \public The scalar of type [wcauchy_type](@ref pm_quadPack::wcauchy_type), containing the Cauchy singularity of the integrand.
114 : character(:, SK) , allocatable :: desc !< \public The scalar `allocatable` character of default kind \SK containing a description of the integrand and integration limits and difficulties.
115 : contains
116 : procedure(get_proc) , deferred :: get !< \public The function member returning the value of the <b>un</b>weighted integrand (whether Cauchy/sin/cos/algebraically types of weights) at a specified input point `x`.
117 : end type
118 :
119 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
120 :
121 : !> \brief
122 : !> This is the abstract interface of the `get()` type-bound procedure of [integrand_type](@ref pm_quadTest::integrand_type)
123 : !> class whose arguments of type `real` are of the highest precision kind \RKH, made available by the processor.
124 : !>
125 : !> \param[in] x : The input scalar `real` of kind \RKH, containing the point at which the integrand must be computed.
126 : ! \param[in] weighted : The input scalar `logical` of default kind \LK.
127 : ! <ol>
128 : ! <li> If it is `.true.`, the function value will be computed **including** its (Cauchy, sin, cos, algebraic, or other type of) weight.<br>
129 : ! Use this if the goal is to test the performance of the algorithms in handling points of difficulties without explicitly specifying them for the integrators.<br>
130 : ! <li> If it is `.false.`, the function value will be computed **excluding** its (Cauchy, sin, cos, algebraic, or other type of) weight.<br>
131 : ! This is typically the value that should be passed to the integrators of [pm_quadPack](@ref pm_quadPack) module.<br>
132 : ! </ol>
133 : !>
134 : !> \see
135 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
136 : !>
137 : !> \finmain{get_proc}
138 : !>
139 : !> \author
140 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
141 : abstract interface
142 : function get_proc(self, x) result(func)
143 : use pm_kind, only: RKC => RKH
144 : import :: integrand_type
145 : class(integrand_type) , intent(in) :: self
146 : real(RKC) , intent(in) :: x
147 : real(RKC) :: func
148 : end function
149 : end interface
150 :
151 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
152 :
153 : !> \brief
154 : !> Run the adaptive global quadrature methods for the specified input integrand object.
155 : !>
156 : !> \details
157 : !> This procedure is created solely for the purpose of facilitating the display of
158 : !> the results of the quadrature of example integrands of [pm_quadTest](@ref pm_quadTest).
159 : !>
160 : !>
161 : !> \param[inout] disp : The input/output object of type [display_type](@ref pm_io::display_type) containing
162 : !> information about the display on which the integration procedure and results should be displayed.<br>
163 : !> \param[in] integrand : The input object of class [integrand_type](@ref pm_quadTest::integrand_type)
164 : !> containing information about the example integrand that is to be integrated.<br>
165 : !> \param[in] abstol : The input positive scalar of the type `real` of kind corresponding to the highest precision available \RKH,
166 : !> representing the absolute tolerance for the integration result.<br>
167 : !> (**optional**. The default value is set by [isFailedQuad]@(ref pm_quadPack::isFailedQuad))<br>
168 : !> \param[in] reltol : The input positive scalar of the type `real` of kind corresponding to the highest precision available \RKH,
169 : !> representing the relative tolerance for the integration result.<br>
170 : !> (**optional**, The default value is set by [isFailedQuad]@(ref pm_quadPack::isFailedQuad))<br>
171 : !> \param[in] nintmax : The input positive scalar of the type `integer` of default kind \IK,
172 : !> representing the maximum number of adaptive interval formations allowed.<br>
173 : !> (**optional**, default = `2000`)<br>
174 : !>
175 : !> \interface{test_isFailedQuad}
176 : !> \code{.F90}
177 : !>
178 : !> use pm_quadTest, only: test_isFailedQuad
179 : !>
180 : !> call test_isFailedQuad(disp, integrand, abstol = abstol, reltol = reltol, nintmax = nintmax)
181 : !>
182 : !> \endcode
183 : !>
184 : !> \see
185 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
186 : !>
187 : !> \test
188 : !> [test_pm_quadPack](@ref test_pm_quadPack)
189 : !>
190 : !> \bug
191 : !> \status \unresolved
192 : !> \source \gfortran{11}
193 : !> \desc
194 : !> The \gfortran cannot handle **submodule** procedures with implicit procedures whose interfaces are **solely** declared in the parent module.<br>
195 : !> The \gfortran cannot recognize the procedure arguments without duplicating the full interface in the submodule.<br>
196 : !> For example, gfortran fails to compile the following submodule procedure interface,<br>
197 : !> For example, gfortran returns the following error code,
198 : !> \code{.sh}
199 : !>
200 : !> 75 | call disp%show("integrand%desc")
201 : !> | 1
202 : !> Error: ‘show’ at (1) should be a SUBROUTINE
203 : !> \endcode
204 : !> \remedy
205 : !> Avoid this coding style until the bug is resolved.
206 : !>
207 : !> \finmain{test_isFailedQuad}
208 : !>
209 : !> \author
210 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
211 : interface test_isFailedQuad
212 : module subroutine test_isFailedQuad_RKH(disp, integrand, abstol, reltol)
213 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
214 : !DEC$ ATTRIBUTES DLLEXPORT :: test_isFailedQuad_RKH
215 : #endif
216 : use pm_kind, only: RKC => RKH
217 : use pm_io, only: display_type
218 : type(display_type) , intent(inout) :: disp
219 : class(integrand_type) , intent(in) :: integrand
220 : real(RKC) , intent(in), optional :: abstol, reltol
221 : end subroutine
222 : end interface
223 :
224 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
225 :
226 : !> \brief
227 : !> Run the adaptive global quadrature methods for the specified input integrand object.
228 : !>
229 : !> \details
230 : !> This procedure is created solely for the purpose of facilitating the display of
231 : !> the results of the quadrature of example integrands of [pm_quadTest](@ref pm_quadTest).
232 : !>
233 : !>
234 : !> \param[inout] disp : The input/output object of type [display_type](@ref pm_io::display_type) containing
235 : !> information about the display on which the integration procedure and results should be displayed.<br>
236 : !> \param[in] integrand : The input object of class [integrand_type](@ref pm_quadTest::integrand_type)
237 : !> containing information about the example integrand that is to be integrated.<br>
238 : !> \param[in] atol : The input positive scalar of the type `real` of kind corresponding to the highest precision available \RKH,
239 : !> representing the absolute tolerance for the integration result.<br>
240 : !> (**optional**, default = `0._RKH`)<br>
241 : !> \param[in] rtol : The input positive scalar of the type `real` of kind corresponding to the highest precision available \RKH,
242 : !> representing the relative tolerance for the integration result.<br>
243 : !> (**optional**, default = `epsilon(0._RKH)**(2/3.)`)<br>
244 : !> \param[in] nintmax : The input positive scalar of the type `integer` of default kind \IK,
245 : !> representing the maximum number of adaptive interval formations allowed.<br>
246 : !> (**optional**, default = `2000`)<br>
247 : !>
248 : !> \interface{test_getQuadErr}
249 : !> \code{.F90}
250 : !>
251 : !> use pm_quadTest, only: test_getQuadErr
252 : !>
253 : !> call test_getQuadErr(disp, integrand, atol = atol, rtol = rtol, nintmax = nintmax)
254 : !>
255 : !> \endcode
256 : !>
257 : !> \see
258 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
259 : !>
260 : !> \test
261 : !> [test_pm_quadPack](@ref test_pm_quadPack)
262 : !>
263 : !> \finmain{test_getQuadErr}
264 : !>
265 : !> \author
266 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
267 : interface test_getQuadErr
268 : module subroutine test_getQuadErr_RKH(disp, integrand, atol, rtol, nintmax)
269 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
270 : !DEC$ ATTRIBUTES DLLEXPORT :: test_getQuadErr_RKH
271 : #endif
272 : use pm_kind, only: RKC => RKH
273 : use pm_io, only: display_type
274 : type(display_type) , intent(inout) :: disp
275 : class(integrand_type) , intent(in) :: integrand
276 : real(RKC) , intent(in), optional :: atol, rtol
277 : integer(IK) , intent(in), optional :: nintmax
278 : end subroutine
279 : end interface
280 :
281 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
282 :
283 : !> \brief
284 : !> This is the derived type for generating test integrand objects of the algebraic form as described below.
285 : !>
286 : !> \details
287 : !> The full integrand is defined as,<br>
288 : !> \f{equation}{
289 : !>
290 : !> f(x) = \frac{x^2}{(x^2 + 1)(x^2 + 4)} ~,~ x \in (\ms{lb}, \ms{ub})
291 : !>
292 : !> \f}
293 : !> where the integration bounds could be infinities.<br>
294 : !> The indefinite integral of the integrand is,<br>
295 : !> \f{equation}{
296 : !>
297 : !> \int f(x) dx = \frac{2}{3} \tan^{-1}\bigg(\frac{x}{2}\bigg) - \frac{1}{3} \tan^{-1}(x) + \mathrm{constant} ~.
298 : !>
299 : !> \f}
300 : !>
301 : !>
302 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
303 : !> (**optional**, default = [getInfNeg(real(0,kind(lb))](@ref pm_except::getInfNeg))<br>
304 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
305 : !> (**optional**, default = [getInfPos(real(0,kind(ub))](@ref pm_except::getInfPos))<br>
306 : !>
307 : !> \interface{Int1_type}
308 : !> \code{.F90}
309 : !>
310 : !> use pm_quadTest, only: Int1_type
311 : !> type(Int1_type) :: integrand
312 : !>
313 : !> integrand = Int1_type(lb = lb, ub = ub)
314 : !> print *, "description: ", integrand%desc
315 : !> print *, "lower limit: ", integrand%lb
316 : !> print *, "upper limit: ", integrand%ub
317 : !> print *, "Example integrand value: ", integrand%get(x)
318 : !>
319 : !> \endcode
320 : !>
321 : !> \see
322 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
323 : !>
324 : !> \test
325 : !> [test_pm_quadPack](@ref test_pm_quadPack)
326 : !>
327 : !> \finmain{Int1_type}
328 : !>
329 : !> \author
330 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
331 : type, extends(integrand_type) :: Int1_type
332 : contains
333 : procedure :: get => getInt1
334 : end type
335 :
336 : !> \cond excluded
337 : interface Int1_type
338 : module function constructInt1(lb, ub) result(self)
339 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
340 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt1
341 : #endif
342 : use pm_kind, only: RKC => RKH
343 : real(RKC), intent(in), optional :: lb, ub
344 : type(Int1_type) :: self
345 : end function
346 : end interface
347 : !> \endcond excluded
348 :
349 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
350 :
351 : interface
352 : module function getInt1(self, x) result(func)
353 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
354 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt1
355 : #endif
356 : use pm_kind, only: RKC => RKH
357 : class(Int1_type) , intent(in) :: self
358 : real(RKC) , intent(in) :: x
359 : real(RKC) :: func
360 : end function
361 : end interface
362 :
363 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
364 :
365 : !> \brief
366 : !> This is the derived type for generating test integrand objects of algebraic form as described below.
367 : !>
368 : !> \details
369 : !> The full integrand is defined over a finite interval as,<br>
370 : !> \f{equation}{
371 : !>
372 : !> f(x) = \frac{1}{\sqrt{a - bx}} ~,~ x \in (0, a / b) ~,~ a > 0 ~,~ b > 0 ~,
373 : !>
374 : !> \f}
375 : !> where the factors \f$a\f$ and \f$b\f$ are any finite positive real numbers.<br>
376 : !> The integrand has a singularity at the upper bound of integration and has the precise value,<br>
377 : !> \f{equation}{
378 : !>
379 : !> \int_{\ms{lb} = 0}^{\ms{ub} = a / b} f(x) dx = -\frac{(2 \sqrt{a - bx})}{b} \bigg|_{lb}^{ub} ~.
380 : !>
381 : !> \f}
382 : !>
383 : !> \param[in] a : The input positive-valued scalar of type `real` of kind \RKH, such that `a / b` represents the upper limit of integration.<br>
384 : !> (**optional**, default = `1.`)<br>
385 : !> \param[in] b : The input positive-valued scalar of type `real` of kind \RKH, such that `a / b` represents the upper limit of integration.<br>
386 : !> (**optional**, default = `1.`)<br>
387 : !>
388 : !> \interface{Int2_type}
389 : !> \code{.F90}
390 : !>
391 : !> use pm_quadTest, only: Int2_type
392 : !> type(IntSinCos_type) :: integrand
393 : !>
394 : !> integrand = Int2_type(a = a, b = b)
395 : !> print *, "description: ", integrand%desc
396 : !> print *, "lower limit: ", integrand%lb
397 : !> print *, "upper limit: ", integrand%ub
398 : !> print *, "Example integrand value: ", integrand%get(x)
399 : !>
400 : !> \endcode
401 : !>
402 : !> \see
403 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
404 : !>
405 : !> \test
406 : !> [test_pm_quadPack](@ref test_pm_quadPack)
407 : !>
408 : !> \finmain{Int2_type}
409 : !>
410 : !> \author
411 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
412 : type, extends(integrand_type) :: Int2_type
413 : real(RKH) :: a, b
414 : contains
415 : procedure :: get => getInt2
416 : end type
417 :
418 : !> \cond excluded
419 : interface Int2_type
420 : module function constructInt2(a, b) result(self)
421 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
422 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt2
423 : #endif
424 : use pm_kind, only: RKC => RKH
425 : real(RKC), intent(in), optional :: a, b
426 : type(Int2_type) :: self
427 : end function
428 : end interface
429 : !> \endcond excluded
430 :
431 : interface
432 : module function getInt2(self, x) result(func)
433 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
434 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt2
435 : #endif
436 : use pm_kind, only: RKC => RKH
437 : class(Int2_type) , intent(in) :: self
438 : real(RKC) , intent(in) :: x
439 : real(RKC) :: func
440 : end function
441 : end interface
442 :
443 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
444 :
445 : !> \brief
446 : !> This is the derived type for generating test integrand objects of algebraic form as described below.
447 : !>
448 : !> \details
449 : !> The full integrand is defined over a finite interval as,<br>
450 : !> \f{equation}{
451 : !>
452 : !> f(x) = \frac{\log(x)}{\sqrt{x}} ~,~ x \in (\ms{lb} = 0, \ms{ub}) ~.
453 : !>
454 : !> \f}
455 : !> The integrand has the precise value,<br>
456 : !> \f{equation}{
457 : !>
458 : !> \int_{\ms{lb} = 0}^{\ms{ub}} f(x) dx = 2 \sqrt{\ms{ub}} (\log(\ms{ub}) - 2) ~.
459 : !>
460 : !> \f}
461 : !>
462 : !> \param[in] ub : The input positive scalar of type `real` of kind \RKH, containing the upper limit of integration.<br>
463 : !> (**optional**, default = `1.`)<br>
464 : !>
465 : !> \interface{Int3_type}
466 : !> \code{.F90}
467 : !>
468 : !> use pm_quadTest, only: Int3_type
469 : !> type(IntSinCos_type) :: integrand
470 : !>
471 : !> integrand = Int3_type(ub = ub)
472 : !> print *, "description: ", integrand%desc
473 : !> print *, "lower limit: ", integrand%lb
474 : !> print *, "upper limit: ", integrand%ub
475 : !> print *, "Example integrand value: ", integrand%get(x)
476 : !>
477 : !> \endcode
478 : !>
479 : !> \see
480 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
481 : !>
482 : !> \test
483 : !> [test_pm_quadPack](@ref test_pm_quadPack)
484 : !>
485 : !> \finmain{Int3_type}
486 : !>
487 : !> \author
488 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
489 : type, extends(integrand_type) :: Int3_type
490 : contains
491 : procedure :: get => getInt3
492 : end type
493 :
494 : !> \cond excluded
495 : interface Int3_type
496 : module function constructInt3(ub) result(self)
497 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
498 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt3
499 : #endif
500 : use pm_kind, only: RKC => RKH
501 : real(RKC), intent(in), optional :: ub
502 : type(Int3_type) :: self
503 : end function
504 : end interface
505 : !> \endcond excluded
506 :
507 : interface
508 : module function getInt3(self, x) result(func)
509 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
510 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt3
511 : #endif
512 : use pm_kind, only: RKC => RKH
513 : class(Int3_type) , intent(in) :: self
514 : real(RKC) , intent(in) :: x
515 : real(RKC) :: func
516 : end function
517 : end interface
518 :
519 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
520 :
521 : !> \brief
522 : !> This is the derived type for generating test integrand objects of the following algebraic form.
523 : !>
524 : !> \details
525 : !> The full integrand is defined as,
526 : !> \f{equation}{
527 : !>
528 : !> f(x) = \frac{\log(x)}{(\log(x)^2 + 1)^2} , x \in (0, 1)
529 : !>
530 : !> \f}
531 : !> with an integral of `-0.189275187882093321180367135892330338053417661540147291526012234`.<br>
532 : !> This integrand is inspired by the examples of John Burkardt test suite for QAGWS routine of QuadPack.<br>
533 : !>
534 : !> \interface{Int4_type}
535 : !> \code{.F90}
536 : !>
537 : !> use pm_quadTest, only: Int4_type
538 : !> type(Int4_type) :: integrand
539 : !>
540 : !> integrand = Int4_type()
541 : !> print *, "description: ", integrand%desc
542 : !> print *, "lower limit: ", integrand%lb
543 : !> print *, "upper limit: ", integrand%ub
544 : !> print *, "Example integrand value: ", integrand%get(x)
545 : !>
546 : !> \endcode
547 : !>
548 : !> \see
549 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
550 : !>
551 : !> \test
552 : !> [test_pm_quadPack](@ref test_pm_quadPack)
553 : !>
554 : !> \finmain{Int4_type}
555 : !>
556 : !> \author
557 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
558 : type, extends(integrand_type) :: Int4_type
559 : contains
560 : procedure :: get => getInt4
561 : end type
562 :
563 : !> \cond excluded
564 : interface Int4_type
565 : module function constructInt4() result(self)
566 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
567 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt4
568 : #endif
569 : use pm_kind, only: RKC => RKH
570 : type(Int4_type) :: self
571 : end function
572 : end interface
573 : !> \endcond excluded
574 :
575 : interface
576 : module function getInt4(self, x) result(func)
577 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
578 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt4
579 : #endif
580 : use pm_kind, only: RKC => RKH
581 : class(Int4_type), intent(in) :: self
582 : real(RKC) , intent(in) :: x
583 : real(RKC) :: func
584 : end function
585 : end interface
586 :
587 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
588 :
589 : !> \brief
590 : !> This is the derived type for generating test integrand objects of the following algebraic form.
591 : !>
592 : !> \details
593 : !> The full integrand is defined as,
594 : !> \f{equation}{
595 : !>
596 : !> f(x) = x^3 \log(\big|(x^2 - 1) (x^2 - 2.)\big|) ~,~ x \in (\ms{lb}, \ms{ub})
597 : !>
598 : !> \f}
599 : !> with four possible singularities depending on the choice of integration range: \f$ [ -\sqrt{2}, -1, 1, \sqrt{2} ] \f$<br>
600 : !> The integral is of the form,<br>
601 : !> \f{equation}{
602 : !>
603 : !> \int_{\ms{lb}}^{\ms{lb}} f(x) dx = 0.25 \bigg[ x^4 \log( \big|(x^2 - 1) (x^2 - 2)\big| ) ) - 4\log(x^2 - 2) - \log(x^2 - 1) - 3x^2 - x^4 \bigg] \bigg|_{\ms{lb}}^{\ms{ub}}
604 : !>
605 : !> \f}
606 : !> This integrand is inspired by and extends the examples of John Burkardt test suite for QAGWS routine of QuadPack.<br>
607 : !>
608 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
609 : !> (**optional**, default = `0`)<br>
610 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
611 : !> (**optional**, default = `3.`)<br>
612 : !>
613 : !> \interface{Int5_type}
614 : !> \code{.F90}
615 : !>
616 : !> use pm_quadTest, only: Int5_type
617 : !> type(Int5_type) :: integrand
618 : !>
619 : !> integrand = Int5_type(lb = lb, ub = ub)
620 : !> print *, "description: ", integrand%desc
621 : !> print *, "lower limit: ", integrand%lb
622 : !> print *, "upper limit: ", integrand%ub
623 : !> print *, "Example integrand value: ", integrand%get(x)
624 : !>
625 : !> \endcode
626 : !>
627 : !> \see
628 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
629 : !>
630 : !> \test
631 : !> [test_pm_quadPack](@ref test_pm_quadPack)
632 : !>
633 : !> \finmain{Int5_type}
634 : !>
635 : !> \author
636 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
637 : type, extends(integrand_type) :: Int5_type
638 : contains
639 : procedure :: get => getInt5
640 : end type
641 :
642 : !> \cond excluded
643 : interface Int5_type
644 : module function constructInt5(lb, ub) result(self)
645 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
646 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt5
647 : #endif
648 : use pm_kind, only: RKC => RKH
649 : real(RKC), intent(in) :: lb, ub
650 : type(Int5_type) :: self
651 : end function
652 : end interface
653 : !> \endcond excluded
654 :
655 : interface
656 : module function getInt5(self, x) result(func)
657 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
658 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt5
659 : #endif
660 : use pm_kind, only: RKC => RKH
661 : class(Int5_type), intent(in) :: self
662 : real(RKC) , intent(in) :: x
663 : real(RKC) :: func
664 : end function
665 : end interface
666 :
667 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
668 :
669 : !> \brief
670 : !> This is the derived type for generating test integrand objects of the following algebraic form.
671 : !>
672 : !> \details
673 : !> The full integrand is defined as,
674 : !> \f{equation}{
675 : !>
676 : !> f(x) = \frac{\log(x)}{1 + 100x^2} , x \in (0, +\infty)
677 : !>
678 : !> \f}
679 : !> with an integral of \f$-\pi\frac{\log(10)}{20}\f$.<br>
680 : !> This integrand is inspired by the examples of John Burkardt test suite for QAGI routine of QuadPack.<br>
681 : !>
682 : !> \interface{Int6_type}
683 : !> \code{.F90}
684 : !>
685 : !> use pm_quadTest, only: Int6_type
686 : !> type(Int6_type) :: integrand
687 : !>
688 : !> integrand = Int6_type()
689 : !> print *, "description: ", integrand%desc
690 : !> print *, "lower limit: ", integrand%lb
691 : !> print *, "upper limit: ", integrand%ub
692 : !> print *, "Example integrand value: ", integrand%get(x)
693 : !>
694 : !> \endcode
695 : !>
696 : !> \see
697 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
698 : !>
699 : !> \test
700 : !> [test_pm_quadPack](@ref test_pm_quadPack)
701 : !>
702 : !> \finmain{Int6_type}
703 : !>
704 : !> \author
705 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
706 : type, extends(integrand_type) :: Int6_type
707 : contains
708 : procedure :: get => getInt6
709 : end type
710 :
711 : !> \cond excluded
712 : interface Int6_type
713 : module function constructInt6() result(self)
714 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
715 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt6
716 : #endif
717 : use pm_kind, only: RKC => RKH
718 : type(Int6_type) :: self
719 : end function
720 : end interface
721 : !> \endcond excluded
722 :
723 : interface
724 : module function getInt6(self, x) result(func)
725 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
726 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt6
727 : #endif
728 : use pm_kind, only: RKC => RKH
729 : class(Int6_type), intent(in) :: self
730 : real(RKC) , intent(in) :: x
731 : real(RKC) :: func
732 : end function
733 : end interface
734 :
735 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
736 :
737 : !> \brief
738 : !> This is the derived type for generating test integrand objects of the following algebraic form.
739 : !>
740 : !> \details
741 : !> The full integrand is defined as,
742 : !> \f{equation}{
743 : !>
744 : !> f(x) = \frac{\log\big( |(1 - x^2)(1 - 2x^2)| \big) - 4\log(x)}{x^5} , x \in (\frac{1}{3}, +\infty)
745 : !>
746 : !> \f}
747 : !> with an integral of \f$52.7407483834714449977291997202299809\f$.<br>
748 : !> The integrand has singularities and break points at `break = [1 / sqrt(2), 1]`.<br>
749 : !>
750 : !> \interface{Int7_type}
751 : !> \code{.F90}
752 : !>
753 : !> use pm_quadTest, only: Int7_type
754 : !> type(Int7_type) :: integrand
755 : !>
756 : !> integrand = Int7_type()
757 : !> print *, "description: ", integrand%desc
758 : !> print *, "lower limit: ", integrand%lb
759 : !> print *, "upper limit: ", integrand%ub
760 : !> print *, "Example integrand value: ", integrand%get(x)
761 : !>
762 : !> \endcode
763 : !>
764 : !> \remark
765 : !> This integrand is a transformation of [Int5_type](@ref pm_quadTest::Int5_type) such that
766 : !> the integral of `Int5_type%get(1/x) / x**2` over `(0, 3)` equals
767 : !> the integral of `Int7_type%get(x)` over `(1/3, +Inf)`.<br>
768 : !>
769 : !> \see
770 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
771 : !>
772 : !> \test
773 : !> [test_pm_quadPack](@ref test_pm_quadPack)
774 : !>
775 : !> \finmain{Int7_type}
776 : !>
777 : !> \author
778 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
779 : type, extends(integrand_type) :: Int7_type
780 : contains
781 : procedure :: get => getInt7
782 : end type
783 :
784 : !> \cond excluded
785 : interface Int7_type
786 : module function constructInt7() result(self)
787 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
788 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt7
789 : #endif
790 : use pm_kind, only: RKC => RKH
791 : type(Int7_type) :: self
792 : end function
793 : end interface
794 : !> \endcond excluded
795 :
796 : interface
797 : module function getInt7(self, x) result(func)
798 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
799 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt7
800 : #endif
801 : use pm_kind, only: RKC => RKH
802 : class(Int7_type), intent(in) :: self
803 : real(RKC) , intent(in) :: x
804 : real(RKC) :: func
805 : end function
806 : end interface
807 :
808 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
809 :
810 : !> \brief
811 : !> This is the derived type for generating test integrand objects of the following algebraic form.
812 : !>
813 : !> \details
814 : !> The full integrand is defined as,
815 : !> \f{equation}{
816 : !>
817 : !> f(x) = -\frac{\log\big( |(1 - x^2)(1 - 2x^2)| \big) - 4\log(x)}{x^5} , x \in (-\infty, -\frac{1}{3})
818 : !>
819 : !> \f}
820 : !> with an integral of \f$52.7407483834714449977291997202299809\f$.<br>
821 : !> The integrand has singularities and break points at `break = [-1, -1 / sqrt(2)]`.<br>
822 : !>
823 : !> \interface{Int8_type}
824 : !> \code{.F90}
825 : !>
826 : !> use pm_quadTest, only: Int8_type
827 : !> type(Int8_type) :: integrand
828 : !>
829 : !> integrand = Int8_type()
830 : !> print *, "description: ", integrand%desc
831 : !> print *, "lower limit: ", integrand%lb
832 : !> print *, "upper limit: ", integrand%ub
833 : !> print *, "Example integrand value: ", integrand%get(x)
834 : !>
835 : !> \endcode
836 : !>
837 : !> \remark
838 : !> This integrand is a transformation of [Int7_type](@ref pm_quadTest::Int7_type) such that
839 : !> the integral of `-Int7_type%get(-x)` over `(1/3, +Inf)` equals
840 : !> the integral of `Int8_type%get(x)` over `(-Inf, -1/3)`.<br>
841 : !>
842 : !> \see
843 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
844 : !>
845 : !> \test
846 : !> [test_pm_quadPack](@ref test_pm_quadPack)
847 : !>
848 : !> \finmain{Int8_type}
849 : !>
850 : !> \author
851 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
852 : type, extends(integrand_type) :: Int8_type
853 : contains
854 : procedure :: get => getInt8
855 : end type
856 :
857 : !> \cond excluded
858 : interface Int8_type
859 : module function constructInt8() result(self)
860 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
861 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt8
862 : #endif
863 : use pm_kind, only: RKC => RKH
864 : type(Int8_type) :: self
865 : end function
866 : end interface
867 : !> \endcond excluded
868 :
869 : interface
870 : module function getInt8(self, x) result(func)
871 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
872 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt8
873 : #endif
874 : use pm_kind, only: RKC => RKH
875 : class(Int8_type), intent(in) :: self
876 : real(RKC) , intent(in) :: x
877 : real(RKC) :: func
878 : end function
879 : end interface
880 :
881 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
882 :
883 : !> \brief
884 : !> This is the derived type for generating test integrand objects of the following algebraic form.
885 : !>
886 : !> \details
887 : !> The full integrand is defined as,
888 : !> \f{equation}{
889 : !>
890 : !> f(x) =
891 : !> \begin{cases}
892 : !> \frac{\log\big( |(1 - x^2)(1 - 2x^2)| \big) - 4\log(x)}{x^5} &, x \in (\frac{1}{3}, +\infty) \\
893 : !> \frac{1}{\pi\sqrt{-(9 + x)(10 + x)}} &, x \in (-10, -9) \\
894 : !> 0 &, \text{otherwise}
895 : !> \end{cases}
896 : !>
897 : !> \f}
898 : !> with an integral of \f$53.7407483834714449977291997202299809\f$.<br>
899 : !> The integrand has singularities and break points at `break = [-10, -9, 1 / sqrt(2), 1]`.<br>
900 : !>
901 : !> \interface{Int9_type}
902 : !> \code{.F90}
903 : !>
904 : !> use pm_quadTest, only: Int9_type
905 : !> type(Int9_type) :: integrand
906 : !>
907 : !> integrand = Int9_type()
908 : !> print *, "description: ", integrand%desc
909 : !> print *, "lower limit: ", integrand%lb
910 : !> print *, "upper limit: ", integrand%ub
911 : !> print *, "Example integrand value: ", integrand%get(x)
912 : !>
913 : !> \endcode
914 : !>
915 : !> \remark
916 : !> This integrand is a transformation of [Int7_type](@ref pm_quadTest::Int7_type)
917 : !> mixed with the PDF of the Beta distribution for the shape parameters \f$(0.5, 0.5)\f$.<br>
918 : !>
919 : !> \see
920 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
921 : !>
922 : !> \test
923 : !> [test_pm_quadPack](@ref test_pm_quadPack)
924 : !>
925 : !> \finmain{Int9_type}
926 : !>
927 : !> \author
928 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
929 : type, extends(integrand_type) :: Int9_type
930 : contains
931 : procedure :: get => getInt9
932 : end type
933 :
934 : !> \cond excluded
935 : interface Int9_type
936 : module function constructInt9() result(self)
937 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
938 : !DEC$ ATTRIBUTES DLLEXPORT :: constructInt9
939 : #endif
940 : use pm_kind, only: RKC => RKH
941 : type(Int9_type) :: self
942 : end function
943 : end interface
944 : !> \endcond excluded
945 :
946 : interface
947 : module function getInt9(self, x) result(func)
948 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
949 : !DEC$ ATTRIBUTES DLLEXPORT :: getInt9
950 : #endif
951 : use pm_kind, only: RKC => RKH
952 : class(Int9_type), intent(in) :: self
953 : real(RKC) , intent(in) :: x
954 : real(RKC) :: func
955 : end function
956 : end interface
957 :
958 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
959 :
960 : !> \brief
961 : !> This is the derived type for generating test integrand objects of the following algebraic form.
962 : !>
963 : !> \details
964 : !> The full integrand is defined as,
965 : !> \f{equation}{
966 : !>
967 : !> \large
968 : !> f(x) = \left(\frac{x}{\ms{lb}} \right)^\alpha \exp\left( -\beta \left[ x - \ms{lb} \right] \right) ~, \ms{lb} \in (0, +\infty)
969 : !>
970 : !> \f}
971 : !> where \f$\beta > 0\f$ with integration range as \f$[\ms{lb}, \ms{ub}]\f$ where \f$\ms{lb} < \ms{ub} < +\infty\f$.<br>
972 : !> The integrand has a singularity at \f$x = 0\f$ with \f$\alpha < 0\f$, but the \f$\ms{lb}\f$ range does not allow singularity to enter the integrand.<br>
973 : !> When \f$\alpha > -1, \ms{ub} = +\infty\f$, this integral can be computed via [regularized upper incomplete Gamma function](@ref pm_mathGamma) \f$Q(\cdot)\f$:<br>
974 : !> \f{equation}{
975 : !>
976 : !> \large
977 : !> f(x)
978 : !> = \frac{ \exp(\beta \ms{lb}) }{ \ms{lb}^\alpha ~ \beta^{\alpha + 1} } ~ \Gamma(\alpha + 1) ~ Q(\alpha + 1, \beta \ms{lb})
979 : !> - \frac{ \exp(\beta \ms{ub}) }{ \ms{ub}^\alpha ~ \beta^{\alpha + 1} } ~ \Gamma(\alpha + 1) ~ Q(\alpha + 1, \beta \ms{ub})
980 : !> ~.
981 : !>
982 : !> \f}
983 : !> Otherwise, the integrand must be computed numerically, in which case, the `integrand` component of object (representing the truth) is set to `NaN`.<br>
984 : !>
985 : !> \param[in] lb : The input scalar of type `real` of kind \RKH.<br>
986 : !> (**optional**, default = `1.`)<br>
987 : !> \param[in] ub : The input scalar of the same type and kind as `a`.<br>
988 : !> (**optional**, default = [getInfPos(self%ub)](@ref pm_except::getInfPos)<br>
989 : !> \param[in] alpha : The input scalar of type `integer` of default kind \IK, standing for Lower Factor, such that `lb = lf * pi` is the lower bound of integration.<br>
990 : !> (**optional**, default = `+1.`)<br>
991 : !> \param[in] beta : The input scalar of type `integer` of default kind \IK, standing for Upper Factor, such that `ub = uf * pi` is the upper bound of integration.<br>
992 : !> (**optional**, default = `+1.`)<br>
993 : !>
994 : !> \interface{IntGamUpp_type}
995 : !> \code{.F90}
996 : !>
997 : !> use pm_quadTest, only: IntGamUpp_type
998 : !> type(IntGamUpp_type) :: integrand
999 : !>
1000 : !> integrand = IntGamUpp_type()
1001 : !> print *, "description: ", integrand%desc
1002 : !> print *, "lower limit: ", integrand%alpha
1003 : !> print *, "lower limit: ", integrand%beta
1004 : !> print *, "lower limit: ", integrand%lb
1005 : !> print *, "upper limit: ", integrand%ub
1006 : !> print *, "Example integrand value: ", integrand%get(x)
1007 : !>
1008 : !> \endcode
1009 : !>
1010 : !> \warning
1011 : !> The condition `0 < lb` must hold for the corresponding input arguments.<br>
1012 : !> The condition `lb < ub` must hold for the corresponding input arguments.<br>
1013 : !> The condition `0 < beta` must hold for the corresponding input arguments.<br>
1014 : !>
1015 : !> \see
1016 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1017 : !>
1018 : !> \test
1019 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1020 : !>
1021 : !> \finmain{IntGamUpp_type}
1022 : !>
1023 : !> \author
1024 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1025 : type, extends(integrand_type) :: IntGamUpp_type
1026 : real(RKH) :: alpha, beta
1027 : real(RKH) :: normfac
1028 : contains
1029 : procedure :: get => getIntGamUpp
1030 : end type
1031 :
1032 : !> \cond excluded
1033 : interface IntGamUpp_type
1034 : module function constructIntGamUpp(lb, ub, alpha, beta) result(self)
1035 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1036 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntGamUpp
1037 : #endif
1038 : use pm_kind, only: RKC => RKH
1039 : real(RKC), intent(in), optional :: lb, ub, alpha, beta
1040 : type(IntGamUpp_type) :: self
1041 : end function
1042 : end interface
1043 : !> \endcond excluded
1044 :
1045 : interface
1046 : module function getIntGamUpp(self, x) result(func)
1047 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1048 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntGamUpp
1049 : #endif
1050 : use pm_kind, only: RKC => RKH
1051 : class(IntGamUpp_type), intent(in) :: self
1052 : real(RKC), intent(in) :: x
1053 : real(RKC) :: func
1054 : end function
1055 : end interface
1056 :
1057 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1058 :
1059 : !> \brief
1060 : !> This is the derived type for generating test integrand objects of the trigonometric form as described below.
1061 : !>
1062 : !> \details
1063 : !> The full integrand is defined over a finite interval as,<br>
1064 : !> \f{equation}{
1065 : !>
1066 : !> f(x) = \cos(a\sin(bx)) ~,~ x \in (-\infty < \ms{lb} = \mathrm{lf} * \pi, \ms{ub} = \mathrm{uf} * \pi < +\infty)
1067 : !>
1068 : !> \f}
1069 : !> where the factors \f$a\f$ and \f$b\f$ are any finite real numbers and \f$(\mathrm{lf}, \mathrm{uf})\f$ are whole numbers (integer-valued).<br>
1070 : !> The definite integral of the integrand is,<br>
1071 : !> \f{equation}{
1072 : !>
1073 : !> \int_{\ms{lb}}^{\ms{ub}} f(x) dx = (\ms{ub} - \ms{lb}) J_0(a) ~,
1074 : !>
1075 : !> \f}
1076 : !> where \f$J_0\f$ is the Modified Bessel function of the zeroth kind.<br>
1077 : !>
1078 : !> \param[in] lf : The input scalar of type `integer` of default kind \IK, standing for Lower Factor, such that `lb = lf * pi` is the lower bound of integration.<br>
1079 : !> (**optional**, default = `-1.`)<br>
1080 : !> \param[in] uf : The input scalar of type `integer` of default kind \IK, standing for Upper Factor, such that `ub = uf * pi` is the upper bound of integration.<br>
1081 : !> (**optional**, default = `+1.`)<br>
1082 : !> \param[in] a : The input scalar of type `real` of kind \RKH.<br>
1083 : !> (**optional**, default = `10.`)<br>
1084 : !> \param[in] b : The input scalar of the same type and kind as `a`.<br>
1085 : !> (**optional**, default = `+1.`)<br>
1086 : !>
1087 : !> \interface{IntSinCos_type}
1088 : !> \code{.F90}
1089 : !>
1090 : !> use pm_quadTest, only: IntSinCos_type
1091 : !> type(IntSinCos_type) :: integrand
1092 : !>
1093 : !> integrand = IntSinCos_type(lb = lb, ub = ub, a = a, b = b)
1094 : !> print *, "description: ", integrand%desc
1095 : !> print *, "lower limit: ", integrand%lb
1096 : !> print *, "upper limit: ", integrand%ub
1097 : !> print *, "Example integrand value: ", integrand%get(x)
1098 : !>
1099 : !> \endcode
1100 : !>
1101 : !> \see
1102 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1103 : !>
1104 : !> \test
1105 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1106 : !>
1107 : !> \finmain{IntSinCos_type}
1108 : !>
1109 : !> \author
1110 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1111 : type, extends(integrand_type) :: IntSinCos_type
1112 : integer(IK) :: lf, uf
1113 : real(RKH) :: a, b
1114 : contains
1115 : procedure :: get => getIntSinCos
1116 : end type
1117 :
1118 : !> \cond excluded
1119 : interface IntSinCos_type
1120 : module function constructIntSinCos(lf, uf, a, b) result(self)
1121 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1122 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntSinCos
1123 : #endif
1124 : use pm_kind, only: RKC => RKH
1125 : integer(IK) , intent(in), optional :: lf, uf
1126 : real(RKC) , intent(in), optional :: a, b
1127 : type(IntSinCos_type) :: self
1128 : end function
1129 : end interface
1130 : !> \endcond excluded
1131 :
1132 : interface
1133 : module function getIntSinCos(self, x) result(func)
1134 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1135 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntSinCos
1136 : #endif
1137 : use pm_kind, only: RKC => RKH
1138 : class(IntSinCos_type) , intent(in) :: self
1139 : real(RKC) , intent(in) :: x
1140 : real(RKC) :: func
1141 : end function
1142 : end interface
1143 :
1144 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1145 :
1146 : !> \brief
1147 : !> This is the derived type for generating test integrand objects of the Probability Density Function of the Normal distribution.
1148 : !>
1149 : !> \details
1150 : !> The full integrand is defined as,
1151 : !> \f{equation}{
1152 : !>
1153 : !> \pi(x | \mu, \sigma) = \frac{1}{\sigma\sqrt{2\pi}}\exp\bigg( -\frac{\big(x - \mu\big)^2}{2\sigma^2} \bigg) ~,~ x \in (-\infty, +\infty)
1154 : !>
1155 : !> \f}
1156 : !>
1157 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1158 : !> (**optional**, default = [getInfNeg(real(0,kind(lb))](@ref pm_except::getInfNeg))<br>
1159 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1160 : !> (**optional**, default = [getInfPos(real(0,kind(ub))](@ref pm_except::getInfPos))<br>
1161 : !> \param[in] mu : The input scalar of the same type and kind as `lb`, representing the location parameter of the Normal distribution.<br>
1162 : !> (**optional**, default = `0`)<br>
1163 : !> \param[in] sigma : The input scalar of the same type and kind as `lb`, representing the scale parameter of the Normal distribution.<br>
1164 : !> (**optional**, default = `1.`)<br>
1165 : !>
1166 : !> \interface{IntNormPDF_type}
1167 : !> \code{.F90}
1168 : !>
1169 : !> use pm_quadTest, only: IntNormPDF_type
1170 : !> type(IntNormPDF_type) :: integrand
1171 : !>
1172 : !> integrand = IntNormPDF_type(lb = lb, ub = ub, mu = mu, sigma = sigma)
1173 : !> print *, "description: ", integrand%desc
1174 : !> print *, "lower limit: ", integrand%lb
1175 : !> print *, "upper limit: ", integrand%ub
1176 : !> print *, "Example integrand value: ", integrand%get(x)
1177 : !>
1178 : !> \endcode
1179 : !>
1180 : !> \see
1181 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1182 : !>
1183 : !> \test
1184 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1185 : !>
1186 : !> \finmain{IntNormPDF_type}
1187 : !>
1188 : !> \author
1189 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1190 : type, extends(integrand_type) :: IntNormPDF_type
1191 : real(RKH) :: mu !< \public The location parameter of the Normal distribution.
1192 : real(RKH) :: sigma !< \public The scale parameter (standard deviation) of the Normal distribution.
1193 : real(RKH) :: invSigma !< \public The inverse scale parameter (standard deviation) of the Normal distribution.
1194 : real(RKH) :: logInvSigma !< \public The natural logarithm of the inverse scale parameter (standard deviation) of the Normal distribution.
1195 : contains
1196 : procedure :: get => getIntNormPDF
1197 : end type
1198 :
1199 : !> \cond excluded
1200 : interface IntNormPDF_type
1201 : module function constructIntNormPDF(lb, ub, mu, sigma) result(self)
1202 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1203 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntNormPDF
1204 : #endif
1205 : use pm_kind, only: RKC => RKH
1206 : real(RKC), intent(in), optional :: lb, ub, mu, sigma
1207 : type(IntNormPDF_type) :: self
1208 : end function
1209 : end interface
1210 : !> \endcond excluded
1211 :
1212 : interface
1213 : module function getIntNormPDF(self, x) result(func)
1214 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1215 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntNormPDF
1216 : #endif
1217 : use pm_kind, only: RKC => RKH
1218 : class(IntNormPDF_type) , intent(in) :: self
1219 : real(RKC) , intent(in) :: x
1220 : real(RKC) :: func
1221 : end function
1222 : end interface
1223 :
1224 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1225 :
1226 : !> \brief
1227 : !> This is the derived type for generating test integrand objects of the Probability Density Function of the Lognormal distribution.
1228 : !>
1229 : !> \details
1230 : !> The full integrand is defined as,
1231 : !> \f{equation}{
1232 : !>
1233 : !> \pi(x | \mu, \sigma) = \frac{1}{x\sigma\sqrt{2\pi}}\exp\bigg( -\frac{\big(\log(x) - \mu\big)^2}{2\sigma^2} \bigg) ~,~ x \in (-\infty, +\infty)
1234 : !>
1235 : !> \f}
1236 : !> with an integral value of `1`.
1237 : !>
1238 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1239 : !> (**optional**, default = `0`)<br>
1240 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1241 : !> (**optional**, default = [getInfPos(real(0,kind(ub))](@ref pm_except::getInfPos))<br>
1242 : !> \param[in] mu : The input scalar of the same type and kind as `lb`, representing the location parameter of the Lognormal distribution.<br>
1243 : !> (**optional**, default = `0`)<br>
1244 : !> \param[in] sigma : The input scalar of the same type and kind as `lb`, representing the scale parameter of the Lognormal distribution.<br>
1245 : !> (**optional**, default = `1.`)<br>
1246 : !>
1247 : !> \interface{IntLogNormPDF_type}
1248 : !> \code{.F90}
1249 : !>
1250 : !> use pm_quadTest, only: IntLogNormPDF_type
1251 : !> type(IntLogNormPDF_type) :: integrand
1252 : !>
1253 : !> integrand = IntLogNormPDF_type(lb = lb, ub = ub, mu = mu, sigma = sigma)
1254 : !> print *, "description: ", integrand%desc
1255 : !> print *, "lower limit: ", integrand%lb
1256 : !> print *, "upper limit: ", integrand%ub
1257 : !> print *, "Example integrand value: ", integrand%get(x)
1258 : !>
1259 : !> \endcode
1260 : !>
1261 : !> \see
1262 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1263 : !>
1264 : !> \test
1265 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1266 : !>
1267 : !> \finmain{IntLogNormPDF_type}
1268 : !>
1269 : !> \author
1270 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1271 : type, extends(integrand_type) :: IntLogNormPDF_type
1272 : real(RKH) :: mu !< \public The location parameter of the Normal distribution.
1273 : real(RKH) :: sigma !< \public The scale parameter (standard deviation) of the Lognormal distribution.
1274 : real(RKH) :: invSigma !< \public The inverse scale parameter (standard deviation) of the Lognormal distribution.
1275 : real(RKH) :: logInvSigma !< \public The natural logarithm of the inverse scale parameter (standard deviation) of the Lognormal distribution.
1276 : contains
1277 : procedure :: get => getIntLogNormPDF
1278 : end type
1279 :
1280 : !> \cond excluded
1281 : interface IntLogNormPDF_type
1282 : module function constructIntLogNormPDF(lb, ub, mu, sigma) result(self)
1283 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1284 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntLogNormPDF
1285 : #endif
1286 : use pm_kind, only: RKC => RKH
1287 : real(RKC), intent(in), optional :: lb, ub, mu, sigma
1288 : type(IntLogNormPDF_type) :: self
1289 : end function
1290 : end interface
1291 : !> \endcond excluded
1292 :
1293 : interface
1294 : module function getIntLogNormPDF(self, x) result(func)
1295 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1296 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntLogNormPDF
1297 : #endif
1298 : use pm_kind, only: RKC => RKH
1299 : class(IntLogNormPDF_type) , intent(in) :: self
1300 : real(RKC) , intent(in) :: x
1301 : real(RKC) :: func
1302 : end function
1303 : end interface
1304 :
1305 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1306 :
1307 : !> \brief
1308 : !> This is the derived type for generating test integrand objects of the Probability Density Function of the GenExpGamma distribution.
1309 : !>
1310 : !> \details
1311 : !> The full integrand is the PDF of the GenExpGamma distribution as defined in the documentation of [pm_distGenExpGamma](@ref pm_distGenExpGamma),
1312 : !> with an integral value of `1` over its full support \f$x \in (-\infty, +\infty)\f$.
1313 : !>
1314 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1315 : !> (**optional**, default = [getInfNeg(real(0,kind(lb))](@ref pm_except::getInfNeg))<br>
1316 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1317 : !> (**optional**, default = [getInfPos(real(0,kind(ub))](@ref pm_except::getInfPos))<br>
1318 : !> \param[in] kappa : The input scalar of the same type and kind as `lb`, representing the shape parameter of the GenExpGamma distribution.<br>
1319 : !> (**optional**, default = `1.`)<br>
1320 : !> \param[in] invOmega : The input scalar of the same type and kind as `lb`, representing the inverse of the scale parameter of the GenExpGamma distribution.<br>
1321 : !> (**optional**, default = `1.`)<br>
1322 : !> \param[in] logSigma : The input scalar of the same type and kind as `lb`, representing the location parameter of the GenExpGamma distribution.<br>
1323 : !> (**optional**, default = `0`)<br>
1324 : !>
1325 : !> \interface{IntGenExpGammaPDF_type}
1326 : !> \code{.F90}
1327 : !>
1328 : !> use pm_quadTest, only: IntGenExpGammaPDF_type
1329 : !> type(IntGenExpGammaPDF_type) :: integrand
1330 : !>
1331 : !> integrand = IntGenExpGammaPDF_type(lb = lb, ub = ub, kappa = kappa, invOmega = invOmega, logSigma = logSigma)
1332 : !> print *, "description: ", integrand%desc
1333 : !> print *, "lower limit: ", integrand%lb
1334 : !> print *, "upper limit: ", integrand%ub
1335 : !> print *, "Example integrand value: ", integrand%get(x)
1336 : !>
1337 : !> \endcode
1338 : !>
1339 : !> \see
1340 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1341 : !>
1342 : !> \test
1343 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1344 : !>
1345 : !> \finmain{IntGenExpGammaPDF_type}
1346 : !>
1347 : !> \author
1348 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1349 : type, extends(integrand_type) :: IntGenExpGammaPDF_type
1350 : real(RKH) :: kappa !< \public The shape parameter of the GenExpGamma distribution.
1351 : real(RKH) :: invOmega !< \public The inverse of the scale parameter of the GenExpGamma distribution.
1352 : real(RKH) :: logSigma !< \public The location parameter of the GenExpGamma distribution.
1353 : real(RKH) :: logPDFNF !< \public The natural logarithm of the normalization factor of the GenExpGamma distribution.
1354 : contains
1355 : procedure :: get => getIntGenExpGammaPDF
1356 : end type
1357 :
1358 : !> \cond excluded
1359 : interface IntGenExpGammaPDF_type
1360 : module function constructIntGenExpGammaPDF(lb, ub, kappa, invOmega, logSigma) result(self)
1361 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1362 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntGenExpGammaPDF
1363 : #endif
1364 : use pm_kind, only: RKC => RKH
1365 : real(RKC) , intent(in), optional :: lb, ub, kappa, invOmega, logSigma
1366 : type(IntGenExpGammaPDF_type) :: self
1367 : end function
1368 : end interface
1369 : !> \endcond excluded
1370 :
1371 : interface
1372 : module function getIntGenExpGammaPDF(self, x) result(func)
1373 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1374 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntGenExpGammaPDF
1375 : #endif
1376 : use pm_kind, only: RKC => RKH
1377 : class(IntGenExpGammaPDF_type) , intent(in) :: self
1378 : real(RKC) , intent(in) :: x
1379 : real(RKC) :: func
1380 : end function
1381 : end interface
1382 :
1383 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1384 :
1385 : !> \brief
1386 : !> This is the derived type for generating test integrand objects of the sum of five Probability Density Functions of the Gamma distribution.
1387 : !>
1388 : !> \details
1389 : !> The full integrand is defined as,
1390 : !> \f{eqnarray}{
1391 : !>
1392 : !> f(x) &=& \pi_\mathcal{G}(x + 9; 0.7, 1) \\ \nonumber
1393 : !> &+& \pi_\mathcal{G}(x + 5; 0.7, 1) \\ \nonumber
1394 : !> &+& \pi_\mathcal{G}(x - 5; 0.7, 1) \\ \nonumber
1395 : !> &+& \pi_\mathcal{G}(2 - x; 0.7, 1) \\ \nonumber
1396 : !> &+& \pi_\mathcal{G}(7 - x; 0.7, 1) \\ \nonumber
1397 : !> &,& x \in (-\infty, +\infty)
1398 : !>
1399 : !> \f}
1400 : !> where \f$\pi_\mathcal{G}\f$ represents the PDF of the Gamma distribution computed via [getGammaLogPDF](@ref pm_distGamma::getGammaLogPDF).<br>
1401 : !> The integrand has five singularities and break points at \f$\ms{break} = [-9, -5, 2, 5, 7]\f$.<br>
1402 : !> By definition, the integral of the integrand over the entire fully-infinite integration range is `5.`.<br>
1403 : !>
1404 : !> \interface{IntPentaGammaInf_type}
1405 : !> \code{.F90}
1406 : !>
1407 : !> use pm_quadTest, only: IntPentaGammaInf_type
1408 : !> type(IntPentaGammaInf_type) :: integrand
1409 : !>
1410 : !> integrand = IntPentaGammaInf_type()
1411 : !> print *, "description: ", integrand%desc
1412 : !> print *, "lower limit: ", integrand%lb
1413 : !> print *, "upper limit: ", integrand%ub
1414 : !> print *, "Example integrand value: ", integrand%get(x)
1415 : !>
1416 : !> \endcode
1417 : !>
1418 : !> \see
1419 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1420 : !>
1421 : !> \test
1422 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1423 : !>
1424 : !> \finmain{IntPentaGammaInf_type}
1425 : !>
1426 : !> \author
1427 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1428 : type, extends(integrand_type) :: IntPentaGammaInf_type
1429 : contains
1430 : procedure :: get => getIntPentaGammaInf
1431 : end type
1432 :
1433 : !> \cond excluded
1434 : interface IntPentaGammaInf_type
1435 : module function constructIntPentaGammaInf() result(self)
1436 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1437 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntPentaGammaInf
1438 : #endif
1439 : use pm_kind, only: RKC => RKH
1440 : type(IntPentaGammaInf_type) :: self
1441 : end function
1442 : end interface
1443 : !> \endcond excluded
1444 :
1445 : interface
1446 : module function getIntPentaGammaInf(self, x) result(func)
1447 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1448 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntPentaGammaInf
1449 : #endif
1450 : use pm_kind, only: RKC => RKH
1451 : class(IntPentaGammaInf_type), intent(in) :: self
1452 : real(RKC) , intent(in) :: x
1453 : real(RKC) :: func
1454 : end function
1455 : end interface
1456 :
1457 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1458 :
1459 : !> \brief
1460 : !> This is the derived type for generating test integrand objects of algebraic form as described below.
1461 : !>
1462 : !> \details
1463 : !> The full integrand is defined over a finite interval as,<br>
1464 : !> \f{equation}{
1465 : !>
1466 : !> f(x) = \frac{1}{(1 + x)\sqrt{x}} ~,~ x \in (0 < \ms{lb}, \ms{ub}) ~.
1467 : !>
1468 : !> \f}
1469 : !> The integrand has the precise value,<br>
1470 : !> \f{equation}{
1471 : !>
1472 : !> \int_{\ms{lb}}^{\ms{ub}} f(x) dx = 2 ( \mathrm{atan}(\sqrt{\ms{ub}}) - \mathrm{atan}(\sqrt{\ms{lb}}) ) ~.
1473 : !>
1474 : !> \f}
1475 : !> This integrand is an extension of the example discussed in Doncker et al (1976), Automatic Computation of Integrals with Singular integrand.<br>
1476 : !>
1477 : !> \param[in] lb : The input negative scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1478 : !> (**optional**, default = `0._RK`)<br>
1479 : !> \param[in] ub : The input positive scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1480 : !> (**optional**, default = [getInfPos(0._RKC)](@ref pm_except::getInfPos))<br>
1481 : !>
1482 : !> \interface{IntDoncker1_type}
1483 : !> \code{.F90}
1484 : !>
1485 : !> use pm_quadTest, only: IntDoncker1_type
1486 : !> type(IntSinCos_type) :: integrand
1487 : !>
1488 : !> integrand = IntDoncker1_type(lb = lb, ub = ub)
1489 : !> print *, "description: ", integrand%desc
1490 : !> print *, "lower limit: ", integrand%lb
1491 : !> print *, "upper limit: ", integrand%ub
1492 : !> print *, "Example integrand value: ", integrand%get(x)
1493 : !>
1494 : !> \endcode
1495 : !>
1496 : !> \see
1497 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1498 : !>
1499 : !> \test
1500 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1501 : !>
1502 : !> \finmain{IntDoncker1_type}
1503 : !>
1504 : !> \author
1505 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1506 : type, extends(integrand_type) :: IntDoncker1_type
1507 : contains
1508 : procedure :: get => getIntDoncker1
1509 : end type
1510 :
1511 : !> \cond excluded
1512 : interface IntDoncker1_type
1513 : module function constructIntDoncker1(lb, ub) result(self)
1514 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1515 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntDoncker1
1516 : #endif
1517 : use pm_kind, only: RKC => RKH
1518 : real(RKC), intent(in), optional :: lb, ub
1519 : type(IntDoncker1_type) :: self
1520 : end function
1521 : end interface
1522 : !> \endcond excluded
1523 :
1524 : interface
1525 : module function getIntDoncker1(self, x) result(func)
1526 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1527 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntDoncker1
1528 : #endif
1529 : use pm_kind, only: RKC => RKH
1530 : class(IntDoncker1_type) , intent(in) :: self
1531 : real(RKC) , intent(in) :: x
1532 : real(RKC) :: func
1533 : end function
1534 : end interface
1535 :
1536 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1537 :
1538 : !> \brief
1539 : !> This is the derived type for generating test integrand objects of algebraic form as described below.
1540 : !>
1541 : !> \details
1542 : !> The full integrand is defined over a finite interval as,<br>
1543 : !> \f{equation}{
1544 : !>
1545 : !> f(x) = \frac{\exp(x)}{\sqrt{-x}} ~,~ x \in (\ms{lb}, \ms{ub} < 0.) ~.
1546 : !>
1547 : !> \f}
1548 : !> The integrand has the precise value,<br>
1549 : !> \f{equation}{
1550 : !>
1551 : !> \int_{\ms{lb} = -\infty}^{\ms{ub}} f(x) dx = \sqrt{\pi} \big(\mathrm{erf}(\sqrt{-\ms{lb}} - \mathrm{erf}(\sqrt{-\ms{ub}}) \big) ~.
1552 : !>
1553 : !> \f}
1554 : !> This integrand is an extension of the example discussed in Doncker et al (1976), Automatic Computation of Integrals with Singular integrand.<br>
1555 : !>
1556 : !> \param[in] lb : The input negative scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1557 : !> (**optional**, default = [getInfNeg(0._RKC)](@ref pm_except::getInfNeg))<br>
1558 : !> \param[in] ub : The input positive scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1559 : !> (**optional**, default = `0._RK`)<br>
1560 : !>
1561 : !> \interface{IntDoncker2_type}
1562 : !> \code{.F90}
1563 : !>
1564 : !> use pm_quadTest, only: IntDoncker2_type
1565 : !> type(IntSinCos_type) :: integrand
1566 : !>
1567 : !> integrand = IntDoncker2_type(lb = lb, ub = ub)
1568 : !> print *, "description: ", integrand%desc
1569 : !> print *, "lower limit: ", integrand%lb
1570 : !> print *, "upper limit: ", integrand%ub
1571 : !> print *, "Example integrand value: ", integrand%get(x)
1572 : !>
1573 : !> \endcode
1574 : !>
1575 : !> \warning
1576 : !> The conditions `lb < ub < 0._RK` must for the relevant input arguments.<br>
1577 : !> \vericons
1578 : !>
1579 : !> \see
1580 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1581 : !>
1582 : !> \test
1583 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1584 : !>
1585 : !> \finmain{IntDoncker2_type}
1586 : !>
1587 : !> \author
1588 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1589 : type, extends(integrand_type) :: IntDoncker2_type
1590 : contains
1591 : procedure :: get => getIntDoncker2
1592 : end type
1593 :
1594 : !> \cond excluded
1595 : interface IntDoncker2_type
1596 : module function constructIntDoncker2(lb, ub) result(self)
1597 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1598 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntDoncker2
1599 : #endif
1600 : use pm_kind, only: RKC => RKH
1601 : real(RKC), intent(in), optional :: lb, ub
1602 : type(IntDoncker2_type) :: self
1603 : end function
1604 : end interface
1605 : !> \endcond excluded
1606 :
1607 : interface
1608 : module function getIntDoncker2(self, x) result(func)
1609 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1610 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntDoncker2
1611 : #endif
1612 : use pm_kind, only: RKC => RKH
1613 : class(IntDoncker2_type) , intent(in) :: self
1614 : real(RKC) , intent(in) :: x
1615 : real(RKC) :: func
1616 : end function
1617 : end interface
1618 :
1619 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1620 :
1621 : !> \brief
1622 : !> This is the derived type for generating test integrand objects of the algebraic form as described below, whose Cauchy Principal Value is to be computed.
1623 : !>
1624 : !> \details
1625 : !> The full integrand is defined as,<br>
1626 : !> \f{equation}{
1627 : !> f(x) = \frac{1}{(x - c)} ~,~ x \in (\ms{lb}, \ms{ub}) ~,~ \ms{lb} < 0 < \ms{ub}
1628 : !> \f}
1629 : !> where the integration bounds are finite values.<br>
1630 : !> The Cauchy Principal value of the integrand is \f$\log\bigg(\frac{\ms{ub} - \ms{cs}}{\ms{lb} - \ms{cs}}\bigg)\f$.<br>
1631 : !>
1632 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1633 : !> (**optional**, default = `-2.`)<br>
1634 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1635 : !> (**optional**, default = `+3.`)<br>
1636 : !> \param[in] cs : The input scalar of the same type and kind as `lb`, containing the Cauchy singularity of the integrand.<br>
1637 : !> (**optional**, default = `+1.`)<br>
1638 : !>
1639 : !> \interface{IntCauchy1_type}
1640 : !> \code{.F90}
1641 : !>
1642 : !> use pm_quadTest, only: IntCauchy1_type
1643 : !> type(IntCauchy1_type) :: integrand
1644 : !>
1645 : !> integrand = IntCauchy1_type(lb = lb, ub = ub, cs = cs)
1646 : !> print *, "description: ", integrand%desc
1647 : !> print *, "lower limit: ", integrand%lb
1648 : !> print *, "upper limit: ", integrand%ub
1649 : !> print *, "singularity: ", integrand%cs
1650 : !> print *, "Example integrand value: ", integrand%get(x)
1651 : !> print *, "Example integrand value without the Cauchy weight: ", integrand%getWeighted(x)
1652 : !>
1653 : !> \endcode
1654 : !>
1655 : !> \see
1656 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1657 : !>
1658 : !> \test
1659 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1660 : !>
1661 : !> \finmain{IntCauchy1_type}
1662 : !>
1663 : !> \author
1664 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1665 : type, extends(integrand_type) :: IntCauchy1_type
1666 : contains
1667 : procedure :: get => getIntCauchy1
1668 : end type
1669 :
1670 : !> \cond excluded
1671 : interface IntCauchy1_type
1672 : module function constructIntCauchy1(lb, ub, cs) result(self)
1673 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1674 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntCauchy1
1675 : #endif
1676 : use pm_kind, only: RKC => RKH
1677 : real(RKC) , intent(in), optional :: lb, ub, cs
1678 : type(IntCauchy1_type) :: self
1679 : end function
1680 : end interface
1681 : !> \endcond excluded
1682 :
1683 : interface
1684 : module function getIntCauchy1(self, x) result(func)
1685 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1686 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntCauchy1
1687 : #endif
1688 : use pm_kind, only: RKC => RKH
1689 : class(IntCauchy1_type) , intent(in) :: self
1690 : real(RKC) , intent(in) :: x
1691 : real(RKC) :: func
1692 : end function
1693 : end interface
1694 :
1695 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1696 :
1697 : !> \brief
1698 : !> This is the derived type for generating test integrand objects of the algebraic form as described below, whose Cauchy Principal Value is to be computed.
1699 : !>
1700 : !> \details
1701 : !> The full integrand is defined as,<br>
1702 : !> \f{equation}{
1703 : !>
1704 : !> f(x) = \frac{1}{(x - \ms{cs1})(x - \ms{cs2})}
1705 : !> ~,~
1706 : !> x \in (-\infty \leq \ms{lb} < \min(\ms{cs1},\ms{cs2}), \min(\ms{cs1},\ms{cs2}) < \ms{ub} < \max(\ms{cs1},\ms{cs2}))
1707 : !> ~\vee~
1708 : !> x \in (\min(\ms{cs1},\ms{cs2}) < \ms{lb} < \max(\ms{cs1},\ms{cs2}), \max(\ms{cs1},\ms{cs2}) < \ms{ub} \leq +\infty)
1709 : !>
1710 : !> \f}
1711 : !> Depending on the choice of integration range, the integrand has either \f$\ms{cs1}\f$ or \f$\ms{cs2}\f$ as its Cauchy singularity (but not both).<br>
1712 : !> The Cauchy Principal value of the integrand is,<br>
1713 : !> \f{equation}{
1714 : !>
1715 : !> \bigg[ \frac{\log(x - \ms{cs1}) - \log(x - \ms{cs2})}{\ms{cs1} - \ms{cs2}} \bigg]_{\ms{lb}}^{\ms{ub}} ~.
1716 : !>
1717 : !> \f}
1718 : !>
1719 : !> \param[in] lb : The input scalar of type `real` of kind \RKH, containing the lower limit of integration.<br>
1720 : !> (**optional**, default = `-2.`)<br>
1721 : !> \param[in] ub : The input scalar of the same type and kind as `lb`, containing the upper limit of integration.<br>
1722 : !> (**optional**, default = `+2.`)<br>
1723 : !> \param[in] cs1 : The input scalar of the same type and kind as `lb`, containing the first pole (Cauchy singularity) of the integrand.<br>
1724 : !> Note that `cs1 < cs2` must hold.<br>
1725 : !> (**optional**, default = `-2.`)<br>
1726 : !> \param[in] cs2 : The input scalar of the same type and kind as `lb`, containing the second pole (Cauchy singularity) of the integrand.<br>
1727 : !> Note that `cs1 < cs2` must hold.<br>
1728 : !> (**optional**, default = `+3.`)<br>
1729 : !>
1730 : !> \interface{IntCauchy2_type}
1731 : !> \code{.F90}
1732 : !>
1733 : !> use pm_quadTest, only: IntCauchy2_type
1734 : !> type(IntCauchy2_type) :: integrand
1735 : !>
1736 : !> integrand = IntCauchy2_type(lb = lb, ub = ub, cs1 = cs1, cs2 = cs2)
1737 : !> print *, "description: ", integrand%desc
1738 : !> print *, "lower limit: ", integrand%lb
1739 : !> print *, "upper limit: ", integrand%ub
1740 : !> print *, "singularity: ", integrand%cs
1741 : !> print *, "Example integrand value: ", integrand%get(x)
1742 : !> print *, "Example integrand value without the Cauchy weight: ", integrand%getWeighted(x)
1743 : !>
1744 : !> \endcode
1745 : !>
1746 : !> \warning
1747 : !> The two Cauchy singularities of the integrand must not be simultaneously present in the in the integration range.<br>
1748 : !> \vericon
1749 : !>
1750 : !> \see
1751 : !> [integrand_type](@ref pm_quadTest::integrand_type)<br>
1752 : !>
1753 : !> \test
1754 : !> [test_pm_quadPack](@ref test_pm_quadPack)
1755 : !>
1756 : !> \finmain{IntCauchy2_type}
1757 : !>
1758 : !> \author
1759 : !> \AmirShahmoradi, Oct 16, 2009, 11:14 AM, Michigan
1760 : type, extends(integrand_type) :: IntCauchy2_type
1761 : real(RKH) , private :: csnot, Pole(2)
1762 : contains
1763 : procedure :: get => getIntCauchy2
1764 : end type
1765 :
1766 : !> \cond excluded
1767 : interface IntCauchy2_type
1768 : module function constructIntCauchy2(lb, ub, cs1, cs2) result(self)
1769 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1770 : !DEC$ ATTRIBUTES DLLEXPORT :: constructIntCauchy2
1771 : #endif
1772 : use pm_kind, only: RKC => RKH
1773 : real(RKC) , intent(in), optional :: lb, ub, cs1, cs2
1774 : type(IntCauchy2_type) :: self
1775 : end function
1776 : end interface
1777 : !> \endcond excluded
1778 :
1779 : interface
1780 : module function getIntCauchy2(self, x) result(func)
1781 : #if __INTEL_COMPILER && DLL_ENABLED && (_WIN32 || _WIN64)
1782 : !DEC$ ATTRIBUTES DLLEXPORT :: getIntCauchy2
1783 : #endif
1784 : use pm_kind, only: RKC => RKH
1785 : class(IntCauchy2_type) , intent(in) :: self
1786 : real(RKC) , intent(in) :: x
1787 : real(RKC) :: func
1788 : end function
1789 : end interface
1790 :
1791 : !%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1792 :
1793 0 : end module pm_quadTest
|