Return a random upper or lower Cholesky factorization.
See the documentation of pm_distChol for details.
- Parameters
-
[in,out] | rng | : The input/output scalar that can be an object of,
-
type rngf_type, implying the use of intrinsic Fortran uniform RNG.
-
type xoshiro256ssw_type, implying the use of xoshiro256** uniform RNG.
|
[out] | rand | : The output matrix of shape (1:ndim, 1:ndim) of,
-
type
complex of kind any supported by the processor (e.g., CK, CK32, CK64, or CK128),
-
type
real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing a random (optionally power-law-distributed determinant) positive-definite matrix.
The output rand can of complex type if and only if the optional input argument method is missing.
|
[in] | subset | : The input scalar constant that can be any of the following:
-
the constant uppDia or an object of type uppDia_type implying that the upper-diagonal triangular block of the argument
rand must be used while the lower subset is not referenced.
-
the constant lowDia or an object of type lowDia_type implying that the lower-diagonal triangular block of the argument
rand must be used while the upper subset is not referenced.
This argument is merely a convenience to differentiate the different procedure functionalities within this generic interface.
Beware that the oppsite subset will not be set to zero explicitly and it is the user responsibility to ensure it.
If needed, the generic interface setMatInit can be used to set the complementary subset to zero.
The generic interface getCholRand can be used to generate random Cholesky factors whose complementary subset elements are all set to zero.
|
Possible calling interfaces ⛓
Return a random upper or lower Cholesky factorization.
This module contains classes and procedures for generating random upper or lower Cholesky factor tria...
- Warning
- The condition
size(rand, 1) == size(rand, 2)
must hold for the corresponding input arguments.
These conditions are verified only if the library is built with the preprocessor macro CHECK_ENABLED=1
.
- See also
- getCovRand
setCovRand
getCholRand
setCholRand
Example usage ⛓
14 integer(IK) :: isub, itry, ndim
16 type(csp_type) :: subset(
2)
18 type(display_type) :: disp
22 do isub
= 1,
size(subset)
26 real(TKG),
allocatable :: rand(:,:), cov(:,:)
30 call disp%show(
"ndim = getUnifRand(2, 5); call setRefilled(rand, 0._TKG, [ndim, ndim])")
32 call disp%show(
"[same_type_as(subset(isub)%val, uppDia), same_type_as(subset(isub)%val, lowDia)]")
33 call disp%show( [
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)] )
34 call disp%show(
"call setCholRand(rngf_type(), rand, subset(isub)%val)")
38 call disp%show(
"cov = matmul(rand, transpose(rand))")
39 cov
= matmul(rand,
transpose(rand))
40 call disp%show(
"isMatClass(cov, posdefmat)")
48 complex(TKG),
allocatable :: rand(:,:), cov(:,:)
52 call disp%show(
"ndim = getUnifRand(2, 5); call setRefilled(rand, cmplx(0, 0, TKG), [ndim, ndim])")
54 call disp%show(
"[same_type_as(subset(isub)%val, uppDia), same_type_as(subset(isub)%val, lowDia)]")
55 call disp%show( [
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)] )
56 call disp%show(
"call setCholRand(rngf_type(), rand, subset(isub)%val)")
60 call disp%show(
"cov = matmul(rand, conjg(transpose(rand)))")
61 cov
= matmul(rand,
conjg(
transpose(rand)))
62 call disp%show(
"isMatClass(cov, posdefmat)")
Allocate or resize (shrink or expand) and refill an input allocatable scalar string or array of rank ...
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 .true. if and only if the input matrix is of the specified input class.
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains the derived types for generating allocatable containers of scalar,...
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 LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
integer, parameter CKS
The single-precision complex kind in Fortran mode. On most platforms, this is a 32-bit real kind.
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...
integer, parameter RKS
The single-precision real kind in Fortran mode. On most platforms, this is an 32-bit real kind.
This module contains abstract and concrete derived types that are required for compile-time resolutio...
type(posdefmat_type), parameter posdefmat
This is a scalar parameter object of type hermitian_type that is exclusively used to signify the Herm...
This is the csp_type type for generating instances of container of scalar unlimited polymorphic objec...
This is a concrete derived type whose instances can be used to define/request the default uniform ran...
This is the derived type for declaring and generating objects of type xoshiro256ssw_type containing a...
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 ⛓
3[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
7+0.999999940,
+0.425585151
8+0.00000000,
+0.904918373
9cov
= matmul(rand,
transpose(rand))
15[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
19+1.00000000,
-0.662149906,
+0.666454554
20+0.00000000,
+0.749371350,
-0.686088085
21+0.00000000,
+0.00000000,
+0.291755944
22cov
= matmul(rand,
transpose(rand))
28[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
32+1.00000000,
+0.914508760
33+0.00000000,
+0.404565990
34cov
= matmul(rand,
transpose(rand))
40[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
44+1.00000000,
+0.652417004,
-0.465997756
45+0.00000000,
+0.757860184,
-0.564494371
46+0.00000000,
+0.00000000,
+0.681316555
47cov
= matmul(rand,
transpose(rand))
53[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
57+1.00000000,
-0.919773340,
-0.524613142,
-0.591849744,
+0.615483634E-1
58+0.00000000,
+0.392450124,
-0.758221209,
-0.591785192,
+0.590273857
59+0.00000000,
+0.00000000,
+0.387145370,
-0.237296417,
-0.559922040
60+0.00000000,
+0.00000000,
+0.00000000,
+0.493147492,
+0.518885195
61+0.00000000,
+0.00000000,
+0.00000000,
+0.00000000,
+0.255017906
62cov
= matmul(rand,
transpose(rand))
68[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
72(
+1.00000000,
+0.00000000), (
+0.958259225,
+0.115046669E-1), (
-0.142230794,
-0.833119005E-1), (
-0.159731761,
-0.427446187), (
-0.475065522E-1,
-0.358440697)
73(
+0.00000000,
+0.00000000), (
+0.285669208,
+0.00000000), (
-0.600978553,
-0.777166784), (
-0.395708233,
-0.306872666), (
-0.268540740,
-0.266245663)
74(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.875554606E-1,
+0.00000000), (
-0.415262729,
-0.544336081), (
-0.508443356,
+0.474356681)
75(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.268840104,
+0.00000000), (
-0.996307805E-1,
-0.475130171)
76(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.840154290E-1,
+0.00000000)
77cov
= matmul(rand,
conjg(
transpose(rand)))
83[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
87(
+1.00000000,
+0.00000000), (
-0.349207632E-1,
+0.805915356), (
+0.429173142,
+0.210942030), (
+0.370629251,
+0.231197536)
88(
+0.00000000,
+0.00000000), (
+0.591000021,
+0.00000000), (
+0.510435402,
-0.319310158), (
-0.595185578,
+0.325467557)
89(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.639383018,
+0.00000000), (
+0.517262638,
-0.169772238)
90(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.229398057,
+0.00000000)
91cov
= matmul(rand,
conjg(
transpose(rand)))
97[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
101(
+1.00000000,
+0.00000000), (
+0.844284773,
+0.240977585), (
+0.269895315,
-0.491238922)
102(
+0.00000000,
+0.00000000), (
+0.478657454,
+0.00000000), (
-0.791895807,
+0.123631977)
103(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.208463624,
+0.00000000)
104cov
= matmul(rand,
conjg(
transpose(rand)))
110[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
114(
+1.00000000,
+0.00000000), (
+0.546078980,
-0.511225283), (
+0.360939860,
-0.832776576E-1), (
+0.595321119,
-0.523544252), (
-0.365521461,
+0.351287991)
115(
+0.00000000,
+0.00000000), (
+0.663661420,
+0.00000000), (
+0.791177332,
+0.465306759), (
-0.474569947,
-0.198456898), (
+0.472455084,
+0.319023192)
116(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.142532006,
+0.00000000), (
-0.704541877E-1,
-0.791039541E-1), (
-0.423498988,
-0.113260699E-1)
117(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.309307754,
+0.00000000), (
+0.832130238E-1,
+0.413113952)
118(
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.246848002,
+0.00000000)
119cov
= matmul(rand,
conjg(
transpose(rand)))
125[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
129(
+0.999999940,
+0.00000000), (
+0.665597796,
+0.744406939)
130(
+0.00000000,
+0.00000000), (
+0.532718636E-1,
+0.00000000)
131cov
= matmul(rand,
conjg(
transpose(rand)))
137[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
141+1.00000000,
+0.00000000,
+0.00000000
142+0.233753592,
+0.972295880,
+0.00000000
143+0.831458628,
+0.191351444,
+0.521594822
144cov
= matmul(rand,
transpose(rand))
150[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
154+1.00000000,
+0.00000000,
+0.00000000,
+0.00000000,
+0.00000000
155-0.965386093,
+0.260825127,
+0.00000000,
+0.00000000,
+0.00000000
156+0.967681646,
+0.178959623,
+0.177667439,
+0.00000000,
+0.00000000
157-0.590900302,
-0.219072565,
+0.714601517,
+0.303625673,
+0.00000000
158+0.528525233,
+0.111198761,
+0.708474457,
+0.284662515,
+0.354015648
159cov
= matmul(rand,
transpose(rand))
165[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
169+1.00000000,
+0.00000000
170+0.617926300,
+0.786235988
171cov
= matmul(rand,
transpose(rand))
177[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
181+1.00000000,
+0.00000000
182-0.965245068,
+0.261346161
183cov
= matmul(rand,
transpose(rand))
189[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
193+1.00000000,
+0.00000000,
+0.00000000
194-0.855897307,
+0.517145753,
+0.00000000
195+0.900649250,
+0.676939264E-1,
+0.429241717
196cov
= matmul(rand,
transpose(rand))
202[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
206(
+1.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
207(
-0.179492041,
+0.434517443), (
+0.882596731,
+0.00000000)
208cov
= matmul(rand,
conjg(
transpose(rand)))
214[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
218(
+1.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
219(
-0.588443458,
-0.596750498), (
+0.545548618,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
220(
-0.195323572,
+0.579052925), (
+0.849264339E-1,
-0.503517270), (
+0.604817569,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
221(
-0.285100907,
-0.206219733), (
+0.382310718,
-0.461558312), (
+0.606806874,
+0.304751098), (
+0.236443251,
+0.00000000), (
+0.00000000,
+0.00000000)
222(
-0.567227341E-1,
+0.448033959), (
+0.417219698,
-0.282653451), (
-0.278970748,
-0.521920860), (
-0.251283675,
-0.328902185), (
+0.143305883,
+0.00000000)
223cov
= matmul(rand,
conjg(
transpose(rand)))
229[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
233(
+1.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
234(
+0.897334039,
-0.182382748), (
+0.401905507,
+0.00000000), (
+0.00000000,
+0.00000000)
235(
-0.135075852,
+0.587263823), (
+0.377067894,
+0.471984863), (
+0.521465182,
+0.00000000)
236cov
= matmul(rand,
conjg(
transpose(rand)))
242[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
246(
+1.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
247(
-0.501975477,
+0.860542715), (
+0.865257531E-1,
+0.00000000), (
+0.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
248(
+0.498893529,
-0.249854982), (
+0.447148412,
+0.486257166), (
+0.502284825,
+0.00000000), (
+0.00000000,
+0.00000000)
249(
+0.141714454,
-0.579694092), (
-0.368996203,
+0.364295363), (
-0.582066536,
-0.175259858), (
+0.740604252E-1,
+0.00000000)
250cov
= matmul(rand,
conjg(
transpose(rand)))
256[
same_type_as(subset(isub)
%val, uppDia),
same_type_as(subset(isub)
%val, lowDia)]
260(
+1.00000000,
+0.00000000), (
+0.00000000,
+0.00000000)
261(
-0.742168576E-1,
+0.686697185), (
+0.723145127,
+0.00000000)
262cov
= matmul(rand,
conjg(
transpose(rand)))
- Test:
- test_pm_distChol
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, Monday March 6, 2017, 3:22 pm, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin.
Definition at line 333 of file pm_distChol.F90.