62 logical(
LK) :: assertion
63 real(
RK) :: integral, relativeError, difference
64 real(
RK),
parameter :: integral_ref
= 0.5_RK
65 real(
RK),
parameter :: tolerance
= 1.e-10_RK
66 integer(
IK) :: numFuncEval, ierr
69 , integrate
= midexp
&
71 , upperLim
= POSBIG_RK
&
72 , maxRelativeError
= 0.1*tolerance
&
73 , nRefinement
= 10_IK &
74 , integral
= integral
&
75 , relativeError
= relativeError
&
76 , numFuncEval
= numFuncEval
&
80 assertion
= ierr
== 0_IK
82 if (
test%traceable
.and. .not. assertion)
then
84 if (
test%traceable
.and. .not. assertion)
then
85 write(
test%disp
%unit,
"(*(g0))")
"ierr = ", ierr,
" /= 0"
91 difference
= abs(integral
- integral_ref)
/ abs(integral_ref)
92 assertion
= difference
< tolerance
93 assertion
= assertion
.and. relativeError
<= tolerance
96 if (
test%traceable
.and. .not. assertion)
then
97 write(
test%disp
%unit,
"(*(g0))")
98 write(
test%disp
%unit,
"(*(g0))")
"integral_ref = ", integral_ref
99 write(
test%disp
%unit,
"(*(g0))")
"integral = ", integral
100 write(
test%disp
%unit,
"(*(g0))")
"difference = ", difference
101 write(
test%disp
%unit,
"(*(g0))")
"relativeError = ", relativeError
102 write(
test%disp
%unit,
"(*(g0))")
116 logical(
LK) :: assertion
117 real(
RK) :: relativeError, difference
119 real(
RK),
parameter :: integral_ref
= 0.078649603525143_RK
120 real(
RK),
parameter :: tolerance
= 1.e-10_RK
121 integer(
IK) :: numFuncEval, ierr
124 , integrate
= midinf
&
126 , upperLim
= POSBIG_RK
&
127 , maxRelativeError
= 0.1*tolerance
&
128 , nRefinement
= 10_IK &
129 , integral
= integral
&
130 , relativeError
= relativeError
&
131 , numFuncEval
= numFuncEval
&
135 assertion
= ierr
== 0_IK
137 if (
test%traceable
.and. .not. assertion)
then
139 if (
test%traceable
.and. .not. assertion)
then
140 write(
test%disp
%unit,
"(*(g0))")
"ierr = ", ierr,
" /= 0"
146 difference
= abs(integral
- integral_ref)
/ abs(integral_ref)
147 assertion
= difference
< tolerance
148 assertion
= assertion
.and. relativeError
<= tolerance
150 if (
test%traceable
.and. .not. assertion)
then
152 write(
test%disp
%unit,
"(*(g0))")
153 write(
test%disp
%unit,
"(*(g0))")
"integral_ref = ", integral_ref
154 write(
test%disp
%unit,
"(*(g0))")
"integral = ", integral
155 write(
test%disp
%unit,
"(*(g0))")
"difference = ", difference
156 write(
test%disp
%unit,
"(*(g0))")
"relativeError = ", relativeError
157 write(
test%disp
%unit,
"(*(g0))")
171 logical(
LK) :: assertion
172 real(
RK) :: relativeError, difference
174 real(
RK),
parameter :: integral_ref
= 0.078649603525143_RK
175 real(
RK),
parameter :: tolerance
= 1.e-4_RK
176 integer(
IK) :: numFuncEval, ierr
179 , integrate
= midinf
&
180 , lowerLim
= POSBIG_RK
&
181 , upperLim
= -1._RK &
182 , maxRelativeError
= 1.e-10_RK &
183 , nRefinement
= 10_IK &
184 , integral
= integral
&
185 , relativeError
= relativeError
&
186 , numFuncEval
= numFuncEval
&
190 assertion
= ierr
== 0_IK
191 if (
test%traceable
.and. .not. assertion)
then
193 if (
test%traceable
.and. .not. assertion)
then
194 write(
test%disp
%unit,
"(*(g0))")
"ierr = ", ierr,
" /= 0"
200 difference
= abs(integral
- integral_ref)
/ abs(integral_ref)
201 assertion
= difference
< tolerance
202 assertion
= assertion
.and. relativeError
<= tolerance
204 if (
test%traceable
.and. .not. assertion)
then
206 write(
test%disp
%unit,
"(*(g0))")
207 write(
test%disp
%unit,
"(*(g0))")
"integral_ref = ", integral_ref
208 write(
test%disp
%unit,
"(*(g0))")
"integral = ", integral
209 write(
test%disp
%unit,
"(*(g0))")
"difference = ", difference
210 write(
test%disp
%unit,
"(*(g0))")
"relativeError = ", relativeError
211 write(
test%disp
%unit,
"(*(g0))")
225 logical(
LK) :: assertion
226 real(
RK) :: relativeError, difference
228 real(
RK),
parameter :: integral_ref
= 1._RK
229 real(
RK),
parameter :: tolerance
= 1.e-10_RK
230 integer(
IK) :: numFuncEval, ierr
233 , integrate
= midpnt
&
234 , lowerLim
= -5._RK &
235 , upperLim
= +5._RK &
236 , maxRelativeError
= 1.e-10_RK &
237 , nRefinement
= 10_IK &
238 , integral
= integral
&
239 , relativeError
= relativeError
&
240 , numFuncEval
= numFuncEval
&
244 assertion
= ierr
== 0_IK
245 if (
test%traceable
.and. .not. assertion)
then
247 if (
test%traceable
.and. .not. assertion)
then
248 write(
test%disp
%unit,
"(*(g0))")
"ierr = ", ierr,
" /= 0"
254 difference
= abs(integral
- integral_ref)
/ abs(integral_ref)
255 assertion
= difference
< tolerance
256 assertion
= assertion
.and. relativeError
<= tolerance
258 if (
test%traceable
.and. .not. assertion)
then
260 write(
test%disp
%unit,
"(*(g0))")
261 write(
test%disp
%unit,
"(*(g0))")
"integral_ref = ", integral_ref
262 write(
test%disp
%unit,
"(*(g0))")
"integral = ", integral
263 write(
test%disp
%unit,
"(*(g0))")
"difference = ", difference
264 write(
test%disp
%unit,
"(*(g0))")
"relativeError = ", relativeError
265 write(
test%disp
%unit,
"(*(g0))")
279 logical(
LK) :: assertion
280 real(
RK) :: relativeError, difference
282 real(
RK),
parameter :: integral_ref
= 1._RK
283 real(
RK),
parameter :: tolerance
= 1.e-10_RK
284 integer(
IK) :: numFuncEval, ierr
287 , lowerLim
= -5._RK &
288 , upperLim
= +5._RK &
289 , maxRelativeError
= 0.1*tolerance
&
290 , nRefinement
= 10_IK &
291 , relativeError
= relativeError
&
292 , numFuncEval
= numFuncEval
&
295 assertion
= ierr
== 0_IK
296 if (
test%traceable
.and. .not. assertion)
then
298 if (
test%traceable
.and. .not. assertion)
then
299 write(
test%disp
%unit,
"(*(g0))")
"ierr = ", ierr,
" /= 0"
305 difference
= abs(integral
- integral_ref)
/ abs(integral_ref)
306 assertion
= difference
< tolerance
307 assertion
= assertion
.and. relativeError
<= tolerance
309 if (
test%traceable
.and. .not. assertion)
then
311 write(
test%disp
%unit,
"(*(g0))")
312 write(
test%disp
%unit,
"(*(g0))")
"integral_ref = ", integral_ref
313 write(
test%disp
%unit,
"(*(g0))")
"integral = ", integral
314 write(
test%disp
%unit,
"(*(g0))")
"difference = ", difference
315 write(
test%disp
%unit,
"(*(g0))")
"relativeError = ", relativeError
316 write(
test%disp
%unit,
"(*(g0))")
326 real(
RK) ,
parameter :: LOG_INVERSE_SQRT_PI
= log(
sqrt(
1._RK / acos(
-1._RK)))
327 real(
RK) ,
parameter :: LOG_TINY
= log(
tiny(
0._RK))
328 real(
RK) ,
intent(in) :: x
330 funcVal
= LOG_INVERSE_SQRT_PI
- x
**2
331 if (funcVal
< LOG_TINY)
then
334 funcVal
= exp(funcVal)
344 real(
RK),
intent(in) :: x
346 funcVal
= exp(
-x
**2)
* log(x)
**2
Generate and return the integral of the input function getFunc() in the closed range [lb,...
This module contains classes and procedures for reporting and handling errors.
character(*, SK), parameter MODULE_NAME
This module contains procedures and generic interfaces for testing for exceptional cases at runtime.
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
integer, parameter RK
The default real kind in the ParaMonte library: real64 in Fortran, c_double in C-Fortran Interoperati...
integer, parameter LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
This module contains classes and procedures to perform numerical integrations.
This module contains a simple unit-testing framework for the Fortran libraries, including the ParaMon...
This module contains tests of the module pm_quadRomb.
logical(LK) function test_getQuadRomb_1()
real(RK) function getTestFuncOpenIntervalMATLAB(x)
logical(LK) function test_doQuadRombOpen_4()
logical(LK) function test_doQuadRombOpen_2()
real(RK) function getTestFuncOpenInterval_1(x)
logical(LK) function test_doQuadRombOpen_3()
logical(LK) function test_doQuadRombOpen_1()
This is the derived type for generating objects to gracefully and verbosely handle runtime unexpected...
This is the derived type test_type for generating objects that facilitate testing of a series of proc...