ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
pm_distUnifElls::getUnifEllsLogPDF Interface Reference

Generate and return the natural logarithm of an approximation of the Probability Density Function (PDF) of the Multiple MultiVariate Uniformly Ellipsoidal (MMVUE) Distribution.
More...

Detailed Description

Generate and return the natural logarithm of an approximation of the Probability Density Function (PDF) of the Multiple MultiVariate Uniformly Ellipsoidal (MMVUE) Distribution.

See the documentation of pm_distUnifElls for details of the definition of the PDF.

Note
Note that the procedures of this generic interface do not require an input X value representing a location within the domain of the density function.
This is fine and intentional by design because the PDF is uniform across the entire support of the PDF.
Parameters
[in]invmul: The input vector of shape (1:nsam) of the same type and kind as the output logPDF, each element of which represents the inverse of the number of ellipsoids within which the corresponding sampled random vector falls.
[in]ndim: The input positive scalar of type integer of default kind IK, containing the number of dimensions of the domain of the distribution.
(optional. It must be present if and only if the input argument nell is also present and chol is missing.)
[in]nell: The input positive scalar of type integer of default kind IK, containing the number of ellpisoids in the distribution.
(optional. It must be present if and only if the input argument ndim is also present and chol is missing.)
[in]chol: The input contiguous array of shape (1:ndim, 1:ndim, 1:nell) whose specified triangular subset contains the Cholesky Factorization of the Gramian matrix of the MMVUE distribution.
(optional, the default is the Identity matrix of rank ndim. It must be present if and only if the input argument subset and invGram are also present.)
Returns
logPDF : The output scalar of,
  1. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the natural logarithm of the PDF of the distribution.


Possible calling interfaces

logPDF = getUnifEllsLogPDF(chol, invmul)
!
Generate and return the natural logarithm of an approximation of the Probability Density Function (PD...
This module contains classes and procedures for computing various statistical quantities related to t...
Warning
The condition 0 < ndim must hold for the corresponding input arguments.
The condition 0 < nell must hold for the corresponding input arguments.
The condition all(invmul <= 1) must hold for the corresponding input arguments.
The condition size(chol, 1) == size(chol, 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.
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.
Remarks
The procedures under this generic interface are elemental when the input argument ndim is present.
See also
pm_ellipsoid
getUnifEllsRand
setUnifEllsRand


Example usage

1program example
2
3 use pm_kind, only: SK
4 use pm_kind, only: IK, LK
5 use pm_io, only: display_type
8 use pm_matrixChol, only: getMatChol, uppDia, lowDia
11 use pm_distChol, only: getCholRand, uppDia
12 use pm_matrixInv, only: getMatInv, choUpp
13 use pm_io, only: getErrTableWrite, trans
14
15 implicit none
16
17 integer(IK) :: ndim, iell, nell, nsam
18
19 type(display_type) :: disp
20 disp = display_type(file = "main.out.F90")
21
22 block
23 use pm_kind, only: TKG => RKD
24 real(TKG), allocatable :: logPDF, mean(:,:), invGram(:, :, :), chol(:, :, :), rand(:, :), mahalSq(:, :), invmul(:)
25
26 call disp%skip()
27 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
28 call disp%show("! Random vectors from Multiple Multivariate Uniform Balls with particular means.")
29 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
30 call disp%skip()
31
32 call disp%skip()
33 call disp%show("ndim = 2; nell = getUnifRand(5, 10); nsam = 2000")
34 ndim = 2; nell = getUnifRand(5, 10); nsam = 2000
35 call disp%show("[ndim, nell, nsam]")
36 call disp%show( [ndim, nell, nsam] )
37 call disp%show("mean = getUnifRand(-5._TKG, +5._TKG, ndim, nell)")
38 mean = getUnifRand(-5._TKG, +5._TKG, ndim, nell)
39 call disp%show("mean")
40 call disp%show( mean )
41 call disp%show("call setResized(mahalSq, [nell, nsam])")
42 call setResized(mahalSq, [nell, nsam])
43 call disp%show("call setResized(rand, [ndim, nsam])")
44 call setResized(rand, [ndim, nsam])
45 call disp%show("call setResized(invmul, nsam)")
46 call setResized(invmul, nsam)
47 call disp%show("call setUnifEllsRand(rngf_type(), rand, mahalSq, invmul, mean)")
48 call setUnifEllsRand(rngf_type(), rand, mahalSq, invmul, mean)
49 call disp%show("logPDF = getUnifEllsLogPDF(invmul, ndim, nell)")
50 logPDF = getUnifEllsLogPDF(invmul, ndim, nell)
51 call disp%show("logPDF")
52 call disp%show( logPDF )
53 call disp%skip()
54
55 call disp%skip()
56 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
57 call disp%show("! Random vectors from Multiple Multivariate Uniform Ellipsoids with particular means.")
58 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
59 call disp%skip()
60
61 call disp%show("call setResized(chol, [ndim, ndim, nell])")
62 call setResized(chol, [ndim, ndim, nell])
63 call disp%show("call setResized(invGram, [ndim, ndim, nell])")
64 call setResized(invGram, [ndim, ndim, nell])
65 call disp%show("do iell = 1, nell; chol(:, :, iell) = getCholRand(0._TKG, ndim, uppDia); invGram(:, :, iell) = getMatInv(chol(:, :, iell), choUpp); end do")
66 do iell = 1, nell; chol(:, :, iell) = getCholRand(0._TKG, ndim, uppDia); invGram(:, :, iell) = getMatInv(chol(:, :, iell), choUpp); end do
67 call disp%show("call setUnifEllsRand(rngf_type(), rand, mahalSq, invmul, mean, chol, uppDia, invGram)")
68 call setUnifEllsRand(rngf_type(), rand, mahalSq, invmul, mean, chol, uppDia, invGram)
69 call disp%show("logPDF = getUnifEllsLogPDF(invmul, chol)")
70 logPDF = getUnifEllsLogPDF(invmul, chol)
71 call disp%show("logPDF")
72 call disp%show( logPDF )
73 call disp%skip()
74
75 end block
76
77end program example
Allocate or resize (shrink or expand) an input allocatable scalar string or array of rank 1....
Generate and return a random upper and lower Cholesky factorization.
Return a collection of random vectors of size ndim from the ndim-dimensional Multiple MultiVariate Un...
Generate and return a scalar or a contiguous array of rank 1 of length s1 of randomly uniformly distr...
Generate and return the iostat code resulting from writing the input table of rank 1 or 2 to the spec...
Definition: pm_io.F90:5940
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 upper or the lower Cholesky factorization of the input symmetric positive-def...
Generate and return the full inverse of an input matrix of general or triangular form directly or thr...
This module contains procedures and generic interfaces for resizing allocatable arrays of various typ...
This module contains classes and procedures for generating random upper or lower Cholesky factor tria...
Definition: pm_distChol.F90:43
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 LK
The default logical kind in the ParaMonte library: kind(.true.) in Fortran, kind(....
Definition: pm_kind.F90:541
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
This module contains procedures and generic interfaces for computing the Cholesky factorization of po...
This module contains abstract and concrete derived types and procedures related to the inversion of s...
This is a concrete derived type whose instances can be used to define/request the default uniform ran...
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! Random vectors from Multiple Multivariate Uniform Balls with particular means.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7ndim = 2; nell = getUnifRand(5, 10); nsam = 2000
8[ndim, nell, nsam]
9+2, +5, +2000
10mean = getUnifRand(-5._TKG, +5._TKG, ndim, nell)
11mean
12-2.4796979686571250, -2.2324086859414072, -4.0794108705286831, -1.2752456501913321, +0.57284736041570739
13-2.0766337185785764, -3.9676085517739494, +2.5868455192286666, -2.5524757020556645, -3.4448758874187000
14call setResized(mahalSq, [nell, nsam])
15call setResized(rand, [ndim, nsam])
16call setResized(invmul, nsam)
17call setUnifEllsRand(rngf_type(), rand, mahalSq, invmul, mean)
18logPDF = getUnifEllsLogPDF(invmul, ndim, nell)
19logPDF
20-5.6926746249475704
21
22
23!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
24! Random vectors from Multiple Multivariate Uniform Ellipsoids with particular means.
25!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26
27call setResized(chol, [ndim, ndim, nell])
28call setResized(invGram, [ndim, ndim, nell])
29do iell = 1, nell; chol(:, :, iell) = getCholRand(0._TKG, ndim, uppDia); invGram(:, :, iell) = getMatInv(chol(:, :, iell), choUpp); end do
30call setUnifEllsRand(rngf_type(), rand, mahalSq, invmul, mean, chol, uppDia, invGram)
31logPDF = getUnifEllsLogPDF(invmul, chol)
32logPDF
33-1.4631085299078808
34
35
Test:
test_pm_distUnifElls


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, Monday March 6, 2017, 3:22 pm, Institute for Computational Engineering and Sciences (ICES), The University of Texas at Austin.

Definition at line 278 of file pm_distUnifElls.F90.


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