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

Generate and return the natural logarithm of the normalization coefficient of the Probability Density Function (PDF) of the MultiVariate Normal distribution as defined in the description of pm_distMultiNorm. More...

Detailed Description

Generate and return the natural logarithm of the normalization coefficient of the Probability Density Function (PDF) of the MultiVariate Normal distribution as defined in the description of pm_distMultiNorm.

See the documentation of pm_distMultiNorm for the definition of the Normalization Factor of the MVN PDF.

Parameters
[in]ndim: The input positive-valued scalar or array of the same shape as other array-like arguments, of type integer of default kind IK, representing the number of dimensions of the MVN distribution.
(optional. It must be present if and only if invCov is missing.)
[in]logSqrtDetInvCov: The input scalar or array of the same shape as other array-like arguments, of the same type and kind as the output logPDFNF representing the natural logarithm of the square root of the determinant of the inverse of the covariance matrix of the target MVN distribution.
This input argument can be obtained by passing the covariance matrix of the MVN distribution to getMatDetSqrtLog or setMatDetSqrtLog and negating the result.
logSqrtDetInvCov = -getMatDetSqrtLog(cov)
(optional, default = 0)
[in]invCov: The input square matrix (of shape (ndim,ndim)) of the same type and kind as the output logPDFNF containing the inverse of the covariance matrix of the target MVN distribution.
(optional. It must be present if and only if ndim is missing.)
[out]info: The output scalar integer of default kind IK. On output, it is 0 if and only if the computation of the determinant of the inverse of the covariance matrix of the target MVN distribution succeeds.
Otherwise, it is set to the order of the leading minor of the specified input subset of mat that is not positive definite, indicating the occurrence of an error.
(optional. It can be present only if invCov input argument is also present. If missing and the Cholesky factorization fails, the program will halt by calling error stop.)
Returns
logPDFNF : The output scalar or array of the same shape as the input array-like arguments, of
  1. type real of kind any supported by the processor (e.g., RK, RK32, RK64, or RK128),
containing the normalization factor of the MVN distribution.


Possible calling interfaces

logPDFNF = getMultiNormLogPDFNF(invCov)
logPDFNF = getMultiNormLogPDFNF(invCov, info)
logPDFNF = getMultiNormLogPDFNF(ndim, logSqrtDetInvCov)
Generate and return the natural logarithm of the normalization coefficient of the Probability Density...
This module contains classes and procedures for computing various statistical quantities related to t...
Warning
The condition 0 < ndim must hold.
This condition is 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. The procedures of this generic interface are always impure when the output optional argument info is present.
Remarks
The procedures under discussion are elemental. The procedures of this generic interface are always non-elemental when the input optional argument invCov is present.


Example usage

1program example
2
3 use pm_kind, only: SK, IK, LK
4 use pm_io, only: display_type
7
8 implicit none
9
10 integer(IK) :: info
11 real, allocatable :: logPDFNF(:)
12
13 type(display_type) :: disp
14 disp = display_type(file = "main.out.F90")
15
16 call disp%skip()
17 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
18 call disp%show("! Compute the normalization factor of the MultiNormorm distribution PDF.")
19 call disp%show("!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
20 call disp%skip()
21
22 call disp%skip()
23 call disp%show("logPDFNF = getMultiNormLogPDFNF(ndim = 3_IK, logSqrtDetInvCov = [-3., .1, 2.])")
24 logPDFNF = getMultiNormLogPDFNF(ndim = 3_IK, logSqrtDetInvCov = [-3., .1, 2.])
25 call disp%show("logPDFNF")
26 call disp%show( logPDFNF )
27 call disp%skip()
28
29 call disp%skip()
30 call disp%show("logPDFNF = getMultiNormLogPDFNF(invCov = reshape([1., .5, .5, 1.], [2, 2]))")
31 logPDFNF = getMultiNormLogPDFNF(invCov = reshape([1., .5, .5, 1.], [2, 2]))
32 call disp%show("logPDFNF")
33 call disp%show( logPDFNF )
34 call disp%skip()
35
36 call disp%skip()
37 call disp%show("logPDFNF = getMultiNormLogPDFNF(reshape([1., .5, .5, 1.], [2, 2]), info)")
38 logPDFNF = getMultiNormLogPDFNF(reshape([1., .5, .5, 1.], [2, 2]), info)
39 call disp%show("logPDFNF")
40 call disp%show( logPDFNF )
41 call disp%show("info")
42 call disp%show( info )
43 call disp%show("if (info /= 0) error stop")
44 if (info /= 0) error stop
45 call disp%skip()
46
47end program example
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.
Definition: pm_io.F90:11726
This is a generic method of the derived type display_type with pass attribute.
Definition: pm_io.F90:11508
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...
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 SK
The default character kind in the ParaMonte library: kind("a") in Fortran, c_char in C-Fortran Intero...
Definition: pm_kind.F90:539
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! Compute the normalization factor of the MultiNormorm distribution PDF.
4!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
5
6
7logPDFNF = getMultiNormLogPDFNF(ndim = 3_IK, logSqrtDetInvCov = [-3., .1, 2.])
8logPDFNF
9-5.75681543, -2.65681553, -0.756815434
10
11
12logPDFNF = getMultiNormLogPDFNF(invCov = reshape([1., .5, .5, 1.], [2, 2]))
13logPDFNF
14-1.98171806, -1.98171806, -1.98171806
15
16
17logPDFNF = getMultiNormLogPDFNF(reshape([1., .5, .5, 1.], [2, 2]), info)
18logPDFNF
19-1.98171806, -1.98171806, -1.98171806
20info
21+0
22if (info /= 0) error stop
23
24
Test:
test_pm_distMultiNorm


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 182 of file pm_distMultiNorm.F90.


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