ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_quadRomb::pwrl_type Type Reference

This is the indicator type for generating instances of objects that indicate the integration interval is open \((a, b)\) and, the intervals should be spaced assuming an integrand that behaves like,. More...

Detailed Description

This is the indicator type for generating instances of objects that indicate the integration interval is open \((a, b)\) and, the intervals should be spaced assuming an integrand that behaves like,.

  1. a decreasing Power-Law (PWL) on a positive support \((a > 0, b > 0)\), such that the upper limit of integration is allowed to be \(b = +\infty\), or
  2. an increasing Power-Law (PWL) on a negative support \((a < 0, b < 0)\), such that the lower limit of integration is allowed to be \(a = -\infty\).

This is an empty derived type that exists solely for generating unique objects that are distinguishable as input arguments to procedures under the generic interface getQuadRomb.


Possible calling interfaces

type(pwrl_type) :: PWRL
This module contains classes and procedures to perform numerical integrations.
Definition: pm_quadRomb.F90:31
This is the indicator type for generating instances of objects that indicate the integration interval...
See also
lbis_type
nexp_type
open_type
pexp_type
pwrl_type
ubis_type
getQuadRomb


Example usage

1program example
2
3 use pm_kind, only: SK, IK, SP => RKS, DP => RKD, QP => RKH ! all real kinds are supported.
8 use pm_io, only: display_type
9
10 implicit none
11
12 integer(IK) :: neval
13
14 real(SP) :: quad_SP, quadref_SP, relerr_SP, avg_SP, std_SP, logMinX_SP, alpha_SP
15 real(DP) :: quad_DP, quadref_DP, relerr_DP, avg_DP, std_DP, logMinX_DP, alpha_DP
16 real(QP) :: quad_QP, quadref_QP, relerr_QP, avg_QP, std_QP, logMinX_QP, alpha_QP
17
18 type(display_type) :: disp
19 disp = display_type(file = "main.out.F90")
20
21 call disp%skip()
22 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
23 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
24 call disp%show("! Compute the Cumulative Distribution Function (CDF) over the semi-infinite interval of Pareto distribution.")
25 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
26 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
27 call disp%skip()
28
29 call disp%skip()
30 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
31 call disp%show("! Compute the numerical integration with single precision.")
32 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
33 call disp%skip()
34
35 call disp%skip()
36 call disp%show("logMinX_SP = 3._SP; alpha_SP = -1._SP")
37 logMinX_SP = 3._SP; alpha_SP = -1._SP
38 call disp%show("quadref_SP = getParetoLogCDF(logx = log(huge(0._SP)), logMinX = logMinX_SP, alpha = alpha_SP)")
39 quadref_SP = getParetoLogCDF(logx = log(huge(0._SP)), logMinX = logMinX_SP, alpha = alpha_SP)
40 call disp%show("quadref_SP")
41 call disp%show( quadref_SP )
42 call disp%show("quad_SP = getQuadRomb(getFunc = getParetoPDF_SP, lb = logMinX_SP, ub = huge(0._SP), tol = epsilon(1._SP) * 100, nref = 4_IK, interval = pwrl_type(), relerr = relerr_SP, neval = neval)")
43 quad_SP = getQuadRomb(getFunc = getParetoPDF_SP, lb = logMinX_SP, ub = huge(0._SP), tol = epsilon(1._SP) * 100, nref = 4_IK, interval = pwrl_type(), relerr = relerr_SP, neval = neval)
44 call disp%show("if (relerr_SP < 0._SP) error stop 'Integration failed to converge.'")
45 if (relerr_SP < 0._SP) error stop 'Integration failed to converge.'
46 call disp%show("relerr_SP ! < 0. if integration fails.")
47 call disp%show( relerr_SP )
48 call disp%show("neval ! # calls to the integrand.")
49 call disp%show( neval )
50 call disp%show("quad_SP ! integral")
51 call disp%show( quad_SP )
52 call disp%skip()
53
54 call disp%skip()
55 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
56 call disp%show("! Compute the numerical integration with double precision.")
57 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
58 call disp%skip()
59
60 call disp%skip()
61 call disp%show("logMinX_DP = 3._DP; alpha_DP = -1._DP")
62 logMinX_DP = 3._DP; alpha_DP = -1._DP
63 call disp%show("quadref_DP = getParetoLogCDF(logx = log(huge(0._DP)), logMinX = logMinX_DP, alpha = alpha_DP)")
64 quadref_DP = getParetoLogCDF(logx = log(huge(0._DP)), logMinX = logMinX_DP, alpha = alpha_DP)
65 call disp%show("quadref_DP")
66 call disp%show( quadref_DP )
67 call disp%show("quad_DP = getQuadRomb(getFunc = getParetoPDF_DP, lb = logMinX_DP, ub = huge(0._DP), tol = epsilon(1._DP) * 100, nref = 7_IK, interval = pwrl_type(), relerr = relerr_DP, neval = neval)")
68 quad_DP = getQuadRomb(getFunc = getParetoPDF_DP, lb = logMinX_DP, ub = huge(0._DP), tol = epsilon(1._DP) * 100, nref = 7_IK, interval = pwrl_type(), relerr = relerr_DP, neval = neval)
69 call disp%show("if (relerr_DP < 0.) error stop 'Integration failed to converge.'")
70 if (relerr_DP < 0.) error stop 'Integration failed to converge.'
71 call disp%show("relerr_DP ! < 0. if integration fails.")
72 call disp%show( relerr_DP )
73 call disp%show("neval ! # calls to the integrand.")
74 call disp%show( neval )
75 call disp%show("quad_DP ! integral")
76 call disp%show( quad_DP )
77 call disp%skip()
78
79 call disp%skip()
80 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
81 call disp%show("! Compute the numerical integration with double precision.")
82 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
83 call disp%skip()
84
85 call disp%skip()
86 call disp%show("logMinX_QP = 1._QP; alpha_QP = -3._QP")
87 logMinX_QP = 1._QP; alpha_QP = -3._QP
88 call disp%show("quadref_QP = getParetoLogCDF(logx = log(huge(0._QP)), logMinX = logMinX_QP, alpha = alpha_QP)")
89 quadref_QP = getParetoLogCDF(logx = log(huge(0._QP)), logMinX = logMinX_QP, alpha = alpha_QP)
90 call disp%show("quadref_QP")
91 call disp%show( quadref_QP )
92 call disp%show("quad_QP = getQuadRomb(getFunc = getParetoPDF_QP, lb = logMinX_QP, ub = huge(0._QP), tol = epsilon(1._QP)*100, nref = 10_IK, interval = pwrl_type(), relerr = relerr_QP, neval = neval)")
93 quad_QP = getQuadRomb(getFunc = getParetoPDF_QP, lb = logMinX_QP, ub = huge(0._QP), tol = epsilon(1._QP)*100, nref = 10_IK, interval = pwrl_type(), relerr = relerr_QP, neval = neval)
94 call disp%show("if (relerr_QP < 0.) error stop 'Integration failed to converge.'")
95 if (relerr_QP < 0.) error stop 'Integration failed to converge.'
96 call disp%show("relerr_QP ! < 0. if integration fails.")
97 call disp%show( relerr_QP )
98 call disp%show("neval ! # calls to the integrand.")
99 call disp%show( neval )
100 call disp%show("quad_QP ! integral")
101 call disp%show( quad_QP )
102 call disp%skip()
103
104contains
105
106 function getParetoPDF_SP(x) result(expPDF)
107 real(SP), intent(in) :: x
108 real(SP) :: expPDF
109 expPDF = exp(getParetoLogPDF(x, alpha = alpha_SP, logMinX = logMinX_SP))
110 end function
111
112 function getParetoPDF_DP(x) result(expPDF)
113 real(DP), intent(in) :: x
114 real(DP) :: expPDF
115 expPDF = exp(getParetoLogPDF(x, alpha = alpha_DP, logMinX = logMinX_DP))
116 end function
117
118 function getParetoPDF_QP(x) result(expPDF)
119 real(QP), intent(in) :: x
120 real(QP) :: expPDF
121 expPDF = exp(getParetoLogPDF(x, alpha = alpha_QP, logMinX = logMinX_QP))
122 end function
123
124 function getNormPDF_SP(x) result(expPDF)
125 real(SP), intent(in) :: x
126 real(SP) :: expPDF
127 expPDF = exp(getNormLogPDF(x, mu = logMinX_SP))
128 end function
129
130 function getNormPDF_DP(x) result(expPDF)
131 real(DP), intent(in) :: x
132 real(DP) :: expPDF
133 expPDF = exp(getNormLogPDF(x, mu = logMinX_DP))
134 end function
135
136 function getNormPDF_QP(x) result(expPDF)
137 real(QP), intent(in) :: x
138 real(QP) :: expPDF
139 expPDF = exp(getNormLogPDF(x, mu = logMinX_QP))
140 end function
141
142end program example
Generate the natural logarithm of probability density function (PDF) of the univariate Normal distrib...
Generate and return the natural logarithm of the Cumulative Distribution Function (CDF) of the (Trunc...
Generate and return the natural logarithm of the Probability Density Function (PDF) of the (Truncated...
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
Generate and return the integral of the input function getFunc() in the closed range [lb,...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for computing various statistical quantities related to t...
This module contains classes and procedures for input/output (IO) or generic display operations on st...
Definition: pm_io.F90:252
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
Definition: pm_io.F90:11393
This module defines the relevant Fortran kind type-parameters frequently used in the ParaMonte librar...
Definition: pm_kind.F90:268
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 RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
Definition: pm_kind.F90:568
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 RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
Definition: pm_kind.F90:858
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Definition: pm_kind.F90:567
Generate and return an object of type display_type.
Definition: pm_io.F90:10282

Example Unix compile command via Intel ifort compiler
1#!/usr/bin/env sh
2rm main.exe
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example Windows Batch compile command via Intel ifort compiler
1del main.exe
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
4main.exe

Example Unix / MinGW compile command via GNU gfortran compiler
1#!/usr/bin/env sh
2rm main.exe
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
4./main.exe

Example output
1
2!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4! Compute the Cumulative Distribution Function (CDF) over the semi-infinite interval of Pareto distribution.
5!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
7
8
9!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10! Compute the numerical integration with single precision.
11!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12
13
14logMinX_SP = 3._SP; alpha_SP = -1._SP
15quadref_SP = getParetoLogCDF(logx = log(huge(0._SP)), logMinX = logMinX_SP, alpha = alpha_SP)
16quadref_SP
17+0.00000000
18quad_SP = getQuadRomb(getFunc = getParetoPDF_SP, lb = logMinX_SP, ub = huge(0._SP), tol = epsilon(1._SP) * 100, nref = 4_IK, interval = pwrl_type(), relerr = relerr_SP, neval = neval)
19if (relerr_SP < 0._SP) error stop 'Integration failed to converge.'
20relerr_SP ! < 0. if integration fails.
21+0.990457671E-8
22neval ! # calls to the integrand.
23+27
24quad_SP ! integral
25+0.248935577E-1
26
27
28!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
29! Compute the numerical integration with double precision.
30!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31
32
33logMinX_DP = 3._DP; alpha_DP = -1._DP
34quadref_DP = getParetoLogCDF(logx = log(huge(0._DP)), logMinX = logMinX_DP, alpha = alpha_DP)
35quadref_DP
36+0.0000000000000000
37quad_DP = getQuadRomb(getFunc = getParetoPDF_DP, lb = logMinX_DP, ub = huge(0._DP), tol = epsilon(1._DP) * 100, nref = 7_IK, interval = pwrl_type(), relerr = relerr_DP, neval = neval)
38if (relerr_DP < 0.) error stop 'Integration failed to converge.'
39relerr_DP ! < 0. if integration fails.
40+0.15800940639871217E-19
41neval ! # calls to the integrand.
42+729
43quad_DP ! integral
44+0.24893534183931615E-1
45
46
47!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48! Compute the numerical integration with double precision.
49!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50
51
52logMinX_QP = 1._QP; alpha_QP = -3._QP
53quadref_QP = getParetoLogCDF(logx = log(huge(0._QP)), logMinX = logMinX_QP, alpha = alpha_QP)
54quadref_QP
55+0.00000000000000000000000000000000000
56quad_QP = getQuadRomb(getFunc = getParetoPDF_QP, lb = logMinX_QP, ub = huge(0._QP), tol = epsilon(1._QP)*100, nref = 10_IK, interval = pwrl_type(), relerr = relerr_QP, neval = neval)
57if (relerr_QP < 0.) error stop 'Integration failed to converge.'
58relerr_QP ! < 0. if integration fails.
59+0.180961348322211011195384953574198665E-35
60neval ! # calls to the integrand.
61+19683
62quad_QP ! integral
63+0.275909580878581741196642827620996662
64
65
Test:
test_pm_quadRomb


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Amir Shahmoradi, September 1, 2017, 12:00 AM, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin

Definition at line 125 of file pm_quadRomb.F90.


The documentation for this type was generated from the following file: