Generate and return the Cumulative Distribution Function (CDF) of a univariate Standard Uniform distribution or a Uniform distribution with the specified support via lower
and upper
input arguments at the specified input values.
More...
Generate and return the Cumulative Distribution Function (CDF) of a univariate Standard Uniform distribution or a Uniform distribution with the specified support via lower
and upper
input arguments at the specified input values.
- Parameters
-
[in] | x | : The input scalar or array of the same shape as other input array arguments, of either
-
If
x is integer , the discrete Uniform distribution CDF with support [lower, upper] will be returned.
-
If
x is integer , the output argument CDF must be of type real of kind RK.
-
If
x is real , the continuous Uniform distribution CDF with support [lower, upper] will be returned.
-
If
x is complex , the two real and imaginary components of CDF will correspond to two independent distributions.
|
[in] | lower | : The input scalar or array of the same shape as other input array arguments, of the same type and kind as x , representing the lower bound of the Uniform distribution.
(optional, default = 0 . It must be present if and only if the input argument upper is also present.) |
[in] | upper | : The input scalar or array of the same shape as other input array arguments, of the same type and kind as x , representing the upper bound of the Uniform distribution.
(optional, default = 1 . It must be present if and only if the input argument lower is also present.) |
- Returns
cdf
: The output scalar or array of the same shape as the input array arguments, of either
-
type
real
of default kind RK (if the input value x
is integer
of kind any supported by the processor (e.g., IK, IK8, IK16, IK32, or IK64)), or
-
type
complex
of the same kind as x
(if the input value x
is of type complex
of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128)),
-
type
real
of the same kind as x
(if the input value x
is of type real
of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128)),
containing the CDF of the specified discrete or continuous Uniform distribution.
Possible calling interfaces ⛓
Generate and return the Cumulative Distribution Function (CDF) of a univariate Standard Uniform distr...
This module contains classes and procedures for computing various statistical quantities related to t...
- Warning
- The
pure
procedure(s) documented herein become impure
when the ParaMonte library is compiled with preprocessor macro CHECK_ENABLED=1
.
By default, these procedures are pure
in release
build and impure
in debug
and testing
builds.
- See also
- getUnifCDF
Example usage ⛓
14 integer(IK) ,
parameter :: NP
= 1000_IK
18 integer(IK) ,
allocatable :: point_IK(:)
19 real(RK) ,
allocatable :: point_RK(:), CDF_RK(:), CDF_IK(:)
20 complex(CK) ,
allocatable :: point_CK(:), CDF_CK(:)
22 integer(IK) :: range_IK, lower_IK
= -3_IK , upper_IK
= +4_IK
23 real(RK) :: range_RK, lower_RK
= -4._RK , upper_RK
= +4._RK
24 complex(CK) :: range_CK, lower_CK
= (
-4._CK,
-1._CK) , upper_CK
= (
+4._CK,
+3._CK)
26 type(display_type) :: disp
29 range_IK
= upper_IK
- lower_IK
30 range_RK
= upper_RK
- lower_RK
31 range_CK
= upper_CK
- lower_CK
33 point_IK
= getRange(lower_IK
- range_IK
/2, upper_IK
+ range_IK
/2)
34 point_RK
= getLinSpace(lower_RK
- range_RK
/2, upper_RK
+ range_RK
/2, count
= NP)
35 point_CK
= getLinSpace(lower_CK
- range_CK
/2, upper_CK
+ range_CK
/2, count
= NP)
36 allocate(CDF_IK(
size(point_IK)))
37 allocate(CDF_RK(
size(point_RK)))
38 allocate(CDF_CK(
size(point_CK)))
41 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
42 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
43 call disp%show(
"! Compute the Cumulative Distribution Function (CDF) of the Uniform distribution at the specified values.")
44 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
45 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
49 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
50 call disp%show(
"! Compute the discrete Uniform CDF at an input scalar integer value.")
51 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
55 call disp%show(
"CDF_IK(1) = getUnifCDF(x = 0_IK)")
66 call disp%show(
"CDF_IK(1) = getUnifCDF(x = 0_IK, lower = lower_IK, upper = upper_IK)")
67 CDF_IK(
1)
= getUnifCDF(x
= 0_IK, lower
= lower_IK, upper
= upper_IK)
73 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
74 call disp%show(
"! Compute the continuous Uniform CDF at an input scalar real value.")
75 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
79 call disp%show(
"CDF_RK(1) = getUnifCDF(x = 0._RK)")
90 call disp%show(
"CDF_RK(1) = getUnifCDF(x = 0._RK, lower = lower_RK, upper = upper_RK)")
91 CDF_RK(
1)
= getUnifCDF(x
= 0._RK, lower
= lower_RK, upper
= upper_RK)
97 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
98 call disp%show(
"! Compute the continuous Uniform CDF at an input scalar complex value.")
99 call disp%show(
"!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
103 call disp%show(
"CDF_CK(1) = getUnifCDF(x = (0._CK,0._CK))")
114 call disp%show(
"CDF_CK(1) = getUnifCDF(x = (0._CK,0._CK), lower = lower_CK, upper = upper_CK)")
115 CDF_CK(
1)
= getUnifCDF(x
= (
0._CK,
0._CK), lower
= lower_CK, upper
= upper_CK)
124 CDF_IK
= getUnifCDF(point_IK, lower_IK, upper_IK)
125 CDF_RK
= getUnifCDF(point_RK, lower_RK, upper_RK)
126 CDF_CK
= getUnifCDF(point_CK, lower_CK, upper_CK)
130 integer :: fileUnit, i
132 open(newunit
= fileUnit, file
= "main.unif.cdf.IK.txt")
133 write(fileUnit,
"(2(g0,:,' '))") (point_IK(i), CDF_IK(i), i
= 1,
size(point_IK))
136 open(newunit
= fileUnit, file
= "main.unif.cdf.RK.txt")
137 write(fileUnit,
"(2(g0,:,' '))") (point_RK(i), CDF_RK(i), i
= 1,
size(point_RK))
140 open(newunit
= fileUnit, file
= "main.unif.cdf.CK.txt")
141 write(fileUnit,
"(4(g0,:,' '))") (point_CK(i), CDF_CK(i), i
= 1,
size(point_CK))
Generate minimally-spaced character, integer, real sequences or sequences at fixed intervals of size ...
Generate count evenly spaced points over the interval [x1, x2] if x1 < x2, or [x2,...
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.
This module contains procedures and generic interfaces for generating ranges of discrete character,...
This module contains procedures and generic interfaces for generating arrays with linear or logarithm...
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 CK
The default complex kind in the ParaMonte library: real64 in Fortran, c_double_complex in C-Fortran I...
integer, parameter IK
The default integer kind in the ParaMonte library: int32 in Fortran, c_int32_t in C-Fortran Interoper...
integer, parameter SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Generate and return an object of type display_type.
Example Unix compile command via Intel ifort
compiler ⛓
3ifort -fpp -standard-semantics -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example Windows Batch compile command via Intel ifort
compiler ⛓
2set PATH=..\..\..\lib;%PATH%
3ifort /fpp /standard-semantics /O3 /I:..\..\..\include main.F90 ..\..\..\lib\libparamonte*.lib /exe:main.exe
Example Unix / MinGW compile command via GNU gfortran
compiler ⛓
3gfortran -cpp -ffree-line-length-none -O3 -Wl,-rpath,../../../lib -I../../../inc main.F90 ../../../lib/libparamonte* -o main.exe
Example output ⛓
23CDF_IK(
1)
= getUnifCDF(x
= 0_IK, lower
= lower_IK, upper
= upper_IK)
42CDF_RK(
1)
= getUnifCDF(x
= 0._RK, lower
= lower_RK, upper
= upper_RK)
54(
+0.0000000000000000,
+1.0000000000000000)
58(
-4.0000000000000000,
-1.0000000000000000)
60(
+4.0000000000000000,
+3.0000000000000000)
61CDF_CK(
1)
= getUnifCDF(x
= (
0._CK,
0._CK), lower
= lower_CK, upper
= upper_CK)
63(
+0.50000000000000000,
+0.25000000000000000)
Postprocessing of the example output ⛓
3import matplotlib.pyplot
as plt
13ylab = {
"IK" :
"Discrete Integer Uniform CDF"
14 ,
"RK" :
"Continuous Real Uniform CDF"
15 ,
"CK" :
"Continuous Complex Uniform CDF"
18for kind
in [
"IK",
"RK",
"CK"]:
20 df = pd.read_csv(
"main.unif.cdf."+kind+
".txt", delimiter =
" ")
22 fig = plt.figure(figsize = 1.25 * np.array([6.4, 4.8]), dpi = 200)
26 plt.plot( df.values[:, 0]
31 plt.plot( df.values[:, 1]
36 ax.legend ( [
"real",
"imaginary"]
40 plt.plot( df.values[:, 0]
46 ax.set_xlabel(
"X", fontsize = 17)
47 ax.set_ylabel(ylab[kind], fontsize = 17)
49 plt.grid(visible =
True, which =
"both", axis =
"both", color =
"0.85", linestyle =
"-")
50 ax.tick_params(axis =
"y", which =
"minor")
51 ax.tick_params(axis =
"x", which =
"minor")
53 plt.savefig(
"getUnifCDF."+kind+
".png")
Visualization of the example output ⛓
- Test:
- test_pm_distUnif
- Todo:
- Normal Priority: This generic interface can be extended to input string arguments to make it compatible with setUnifRand.
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.
-
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.
-
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.
- Copyright
- Computational Data Science Lab
- Author:
- Amir Shahmoradi, Oct 16, 2009, 11:14 AM, Michigan
Definition at line 395 of file pm_distUnif.F90.