12 real(RKG),
allocatable :: alpha, beta, betaInc(:), betaInv(:)
14 type(display_type) :: disp
18 call disp%show(
"betaInc = [0.5_RKG]")
20 call disp%show(
"alpha = getUnifRand(0.1_RKG, 10._RKG); beta = getUnifRand(0.1_RKG, 10._RKG)")
24 call disp%show(
"betaInv = getBetaInv(betaInc, alpha, beta)")
28 call disp%show(
"getBetaInc(betaInv, alpha, beta)")
33 call disp%show(
"betaInc = [0.5_RKG]")
35 call disp%show(
"alpha = getUnifRand(0.1_RKG, 10._RKG); beta = getUnifRand(0.1_RKG, 10._RKG)")
39 call disp%show(
"betaInv = getBetaInv(betaInc, alpha, beta)")
43 call disp%show(
"getBetaInc(betaInv, alpha, beta)")
48 call disp%show(
"betaInc = [1._RKG - epsilon(1._RKG)]")
49 betaInc
= [
1._RKG - epsilon(
1._RKG)]
50 call disp%show(
"alpha = getUnifRand(0.1_RKG, 10._RKG); beta = getUnifRand(0.1_RKG, 10._RKG)")
54 call disp%show(
"betaInv = getBetaInv(betaInc, alpha, beta)")
58 call disp%show(
"getBetaInc(betaInv, alpha, beta)")
63 call disp%show(
"betaInc = [0._RKG, .5_RKG, 1._RKG]")
64 betaInc
= [
0._RKG, .
5_RKG,
1._RKG]
65 call disp%show(
"alpha = getUnifRand(0.1_RKG, 10._RKG); beta = getUnifRand(0.1_RKG, 10._RKG)")
69 call disp%show(
"betaInv = getBetaInv(betaInc, alpha, beta)")
73 call disp%show(
"getBetaInc(betaInv, alpha, beta)")
78 call disp%show(
"betaInc = [0._RKG, .5_RKG, 1._RKG]")
79 betaInc
= [
0._RKG, .
5_RKG,
1._RKG]
80 call disp%show(
"betaInv = getBetaInv(betaInc, alpha = [.1_RKG, 1._RKG, 10._RKG], beta = 3._RKG)")
81 betaInv
= getBetaInv(betaInc, alpha
= [.
1_RKG,
1._RKG,
10._RKG], beta
= 3._RKG)
84 call disp%show(
"getBetaInc(betaInv, alpha = [.1_RKG, 1._RKG, 10._RKG], beta = 3._RKG)")
85 call disp%show(
getBetaInc(betaInv, alpha
= [.
1_RKG,
1._RKG,
10._RKG], beta
= 3._RKG) )
96 integer(IK) ,
parameter :: NP
= 1000
97 real(RKG) ,
parameter :: alpha(
*)
= [
0.1_RKG,
10._RKG,
1._RKG,
0.1_RKG,
10._RKG], beta(
*)
= [
0.1_RKG,
0.1_RKG,
1._RKG,
10._RKG,
10._RKG]
98 real(RKG) :: betaInv(
max(
size(alpha),
size(beta)))
99 real(RKG) :: betaInvRef(
size(betaInv))
100 real(RKG) :: betaInc(NP)
101 integer :: fileUnit, i, j
103 call setLinSpace(betaInc,
0._RKG,
1._RKG, fopen
= .true._LK, lopen
= .true._LK)
104 open(newunit
= fileUnit, file
= "getBetaInv.RK.txt")
107 write(fileUnit,
"(*(g0,:,','))") betaInc(i), betaInv
113 character(
*),
parameter :: RKSTR
= "RKS"
114 real(RKG) :: betaInv(
max(
size(alpha),
size(beta)))
115 open(newunit
= fileUnit, file
= "getBetaInv."//RKSTR
//".abserr.txt")
117 betaInv
= getBetaInv(
real(betaInc(i), RKG),
real(alpha, RKG),
real(beta, RKG))
118 betaInvRef
= getBetaInv(betaInc(i), alpha, beta, signed
= .true._LK)
119 write(fileUnit,
"(*(g0,:,','))") betaInc(i), abs(betaInv
- merge(
1 + betaInvRef, betaInvRef, betaInvRef
< 0))
126 character(
*),
parameter :: RKSTR
= "RKD"
127 real(RKG) :: betaInv(
max(
size(alpha),
size(beta)))
128 open(newunit
= fileUnit, file
= "getBetaInv."//RKSTR
//".abserr.txt")
130 betaInv
= getBetaInv(
real(betaInc(i), RKG),
real(alpha, RKG),
real(beta, RKG))
131 betaInvRef
= getBetaInv(betaInc(i), alpha, beta, signed
= .true._LK)
132 write(fileUnit,
"(*(g0,:,','))") betaInc(i), abs(betaInv
- merge(
1 + betaInvRef, betaInvRef, betaInvRef
< 0))
139 character(
*),
parameter :: RKSTR
= "RKH"
140 real(RKG) :: betaInv(
max(
size(alpha),
size(beta)))
141 open(newunit
= fileUnit, file
= "getBetaInv."//RKSTR
//".abserr.txt")
143 betaInv
= getBetaInv(
real(betaInc(i), RKG),
real(alpha, RKG),
real(beta, RKG))
144 betaInvRef
= getBetaInv(betaInc(i), alpha, beta, signed
= .true._LK)
145 write(fileUnit,
"(*(g0,:,','))") betaInc(i), abs(betaInv
- merge(
1 + betaInvRef, betaInvRef, betaInvRef
< 0))
Return the linSpace output argument with size(linSpace) elements of evenly-spaced values over the int...
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
This is a generic method of the derived type display_type with pass attribute.
This is a generic method of the derived type display_type with pass attribute.
Generate and return the regularized Incomplete Beta Function as defined in the details section of pm...
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
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...
type(display_type) disp
This is a scalar module variable an object of type display_type for general display.
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...
integer, parameter RKD
The double precision real kind in Fortran mode. On most platforms, this is an 64-bit real kind.
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
integer, parameter RKH
The scalar integer constant of intrinsic default kind, representing the highest-precision real kind t...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
Generate and return an object of type display_type.
3import matplotlib.pyplot
as plt
13label = [
r"$\alpha, \beta = .1, .1$"
14 ,
r"$\alpha, \beta = 10, .1$"
15 ,
r"$\alpha, \beta = 1., 1.$"
16 ,
r"$\alpha, \beta = .1, 10$"
17 ,
r"$\alpha, \beta = 10, 10$"
20parent = os.path.basename(os.path.dirname(__file__))
21pattern = parent +
"*.txt"
23fileList = glob.glob(pattern)
26 df = pd.read_csv(file, delimiter =
",")
28 fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
31 for i
in range(1,len(df.values[0,:]+1)):
33 plt.plot( df.values[:, 0]
38 plt.xticks(fontsize = fontsize - 2)
39 plt.yticks(fontsize = fontsize - 2)
41 nbit = file.split(
".")[1][2:]
42 ax.set_xlabel(
"X : Regularized Incomplete Beta Function", fontsize = fontsize)
43 ax.set_ylabel(
"{}-bits Absolute Error: X - BetaInc(BetaInv(X))".format(nbit), fontsize = fontsize)
45 ax.set_xlabel(
"x", fontsize = fontsize)
46 ax.set_ylabel(
"Regularized Inverse Beta Function", fontsize = fontsize)
54 plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
55 ax.tick_params(axis =
"y", which =
"minor")
56 ax.tick_params(axis =
"x", which =
"minor")
59 plt.savefig(file.replace(
".txt",
".png"))