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...
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
-
[out] | cdf | : The output scalar or contiguous array of rank 1 of either
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128) (if the input value X is of type complex ) or,
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128) (if the input value X is of type integer or real ),
containing the CDF of the specified discrete or continuous Uniform distribution. |
[in] | X | : The input scalar or contiguous array of the same shape as cdf , containing the values at which the CDF must be computed.
If X is of type integer , the CDF of the discrete Uniform distribution with support [lower, upper] will be returned.
If X is of type integer , the output argument CDF must be of type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128).
If X is of type real , the output argument CDF must have the same type, kind, and rank as X , and will contain the CDF of the continuous Uniform distribution with support [lower, upper) .
If X is of type complex , the output argument CDF must have the same type, kind, and rank as X .
If X is of type complex , the two real and imaginary components of CDF will correspond to two independent distributions.
|
[in] | lower | : The input scalar of the same type and kind as X , representing the lower bound of the Uniform distribution.
(optional, default = 0 . If present, then upper must also be present.) |
[in] | upper | : The input scalar of the same type and kind as X , representing the upper bound of the Uniform distribution.
(optional, default = 1 . If present, then lower must also be present.) |
Possible calling interfaces ⛓
Return the Cumulative Distribution Function (CDF) of a univariate Standard Uniform distribution or a ...
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(
"call setUnifCDF(CDF_IK(1), x = 0_IK)")
66 call disp%show(
"call setUnifCDF(CDF_IK(1), x = 0_IK, lower = lower_IK, upper = upper_IK)")
67 call setUnifCDF(CDF_IK(
1), 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(
"call setUnifCDF(CDF_RK(1), x = 0._RK)")
90 call disp%show(
"call setUnifCDF(CDF_RK(1), x = 0._RK, lower = lower_RK, upper = upper_RK)")
91 call setUnifCDF(CDF_RK(
1), 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(
"call setUnifCDF(CDF_CK(1), x = (0._CK,0._CK))")
114 call disp%show(
"call setUnifCDF(CDF_CK(1), x = (0._CK,0._CK), lower = lower_CK, upper = upper_CK)")
115 call setUnifCDF(CDF_CK(
1), x
= (
0._CK,
0._CK), lower
= lower_CK, upper
= upper_CK)
124 call setUnifCDF(CDF_IK, Point_IK, lower_IK, upper_IK)
125 call setUnifCDF(CDF_RK, Point_RK, lower_RK, upper_RK)
126 call setUnifCDF(CDF_CK, 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 ⛓
23call setUnifCDF(CDF_IK(
1), x
= 0_IK, lower
= lower_IK, upper
= upper_IK)
42call setUnifCDF(CDF_RK(
1), x
= 0._RK, lower
= lower_RK, upper
= upper_RK)
54(
+0.0000000000000000,
+1.0000000000000000)
58(
-4.0000000000000000,
-1.0000000000000000)
60(
+4.0000000000000000,
+3.0000000000000000)
61call setUnifCDF(CDF_CK(
1), 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(
"setUnifCDF."+kind+
".png")
Visualization of the example output ⛓
- Test:
- test_pm_distUnif
- Todo:
- Low Priority: This generic interface can be extended to input arguments with ranks higher than
1
.
- 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 835 of file pm_distUnif.F90.