ParaMonte C++ 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
This is the ParaMonte C++ documentation website for the C++ users and developers.
ParaMonte is a multi-language library of serial and parallel Monte Carlo and Machine Learning routines scientific inference, e.g., for sampling mathematical density functions of arbitrary-dimensions, with the design goal of unifying
The ParaMonte library is open-source and is permanently located and maintained on GitHub at:
https://github.com/cdslaborg/paramonte
The pre-built releases of the ParaMonte library for select configurations and compilers are available on GitHub Release page at:
https://github.com/cdslaborg/paramonte/releases
For instructions to build the ParaMonte library from source files, visit the ParaMonte library main documentation website linked below.
For information about the ParaMonte library in general and in other supported programming languages, visit:
https://www.cdslab.org/paramonte
The documentation for the latest version of the ParaMonte C++ library is always available on this page.
The ParaMonte C++ library currently contains,
The ParaMonte C++ library is currently under active development to extend the library functionalities to other tasks supported by the ParaMonte Fortran library.
For a full list of all available functionalities and modules, see the modules listing of this documentation website.
Module | Functionality |
---|---|
pm_sampling | This module contains procedures and generic interfaces for the ParaMonte C++ library sampler routines. |
The following modules are currently under development for future addition to the ParaMonte C++ library.
Module | Functionality |
---|---|
pm_optimization | This module contains procedures, generic interfaces, and types for numerical optimizations of mathematical functions. |
pm_quadPack | This module contains procedures for non-adaptive and adaptive global numerical quadrature. |
pm_quadRomb | This module contains procedures for numerical integrations. |
By convention in this library,
Vec
or Vector
.Mat
or Matrix
.true
or false
.parallelismMpiFinalizeEnabled
is one such proposition.is
can also be used to label _Bool
objects.getCov
means generate (a) covariance matrix.setMatCopy
means copy the matrix into the specified buffer.get
.getMatSym(mat)
generates a symmetric version of the input matrix and returns it as the function result.get
prefix is inconvenient or when the function returns a _Bool
result._Bool
should be preferably prefixed with is
or be named such that the name begins with a verb and reads as a proposition, evaluating to either true or false.get
should be avoided as a prefix for void
function names since void
functions do not generate and get a new object as their results, rather they (re)set the state of existing objects passed to them.void
functions is set
, i.e., setReplaced()
.The following list of abbreviations is in alphabetical order to enable faster search:
avg
stands for average (rarely used).cdf
stands for Cumulative Distribution Function in the context of statistics. Example: getNormCDF()
.cho
stands for Cholesky factorization. Example: setChoLow()
.chol
stands for Cholesky factorization. Example: setMatChol()
.cor
stands for correlation. Example: getCor()
.cov
stands for covariance. Example: getCov()
.cum
stands for cumulative. Example: getCumSum()
.coef
stands for coefficient. Example: corcoef_type()
.def
stands for default in variable names (mostly as a prefix def_
or suffix _def
).def
stands for definite (mostly in procedure names dealing with positive-definite matrices)den
stands for density, mostly in the context of statistical procedures and objects. Example: getLogProbDen()
.det
stands for determinant, mostly in the context of Matrix and linear algebra. Example: getMatDet()
.dia
stands for diagonal, mostly in the context of matrix algebra, matrix packing, or Cholesky factorization. Example: dia_type()
.diag
stands for diagonal, mostly as dummy argument in matrix algebra procedures.desc
stands for description, mostly as a dummy argument in tests.diff
stands for difference. Example: setDisSortedExpDiff()
.dist
stands for distance or distribution depending on the context. Example: DistMulti_type
.eff
stands for effective. Example: effSamSize
.exp
stands for exponential or exponentiated. Example: setDisSortedExpDiff()
.hell
stands for Hellinger in statistical distance computations. Example: getDisHellSq()
.herm
stands for hermitian in matrix algebra.ICE
stands for Internal Compiler Error. It typically appears in the bug descriptions tagged via Doxygen command \bug
.inv
stands for inverse. Example: getMatInv()
.ks
stands for Kolmogorov-Smirnov test. Example: getProbKS()
.lin
stands for linear. Example: getLinSpace()
.low
stands for lower triangle of a matrix or lower limits. Example: setChoLow()
.mahal
stands for Mahalanobis distance. Example: getDisMahalSq()
.mat
stands for matrix. Example: getMatInv()
.multi
stands for multivariate mostly used in the context of statistical distributions. Example: getMultiNormRand()
.msn
stands for Multivariate Skew-Normal mostly used in the context of the statistical MultiVariate Skew-Normal distribution.mvn
stands for MultiVariate Normal mostly used in the context of the statistical MultiVariate Normal distribution.mvu
stands for MultiVariate Uniform mostly used in the context of the statistical MultiVariate (ellipsoidal) Uniform distribution.norm
stands for normal in the context of statistical distributions or normalization factor. Example: DistMultiNorm_type
.normed
stands for normalized mostly in the context of statistical samples. Example: NormedSample
.pdf
stands for Probability Density Function in the context of statistics. Example: getNormLogPDF()
.pos
stands for positive. Example: getInvPosDefMat()
.prob
stands for probability
, mostly in the context of statistical applications. Example: getLogProb()
.proc
stands for procedure
, particularly, when it appears as the suffix _proc
in abstract interface
definitions.quan
stands for quantile, mostly in the context of statistics. Example: getParetoLogQuan()
.rand
stands for random, mostly in the context of statistics. Example: getUnifRand()
.ref
stands for reference, mostly in the context of testings to represent the reference values for comparison. Example: mean_ref
.sam
stands for sample, mostly in the context of statistics. Example: effSamSize
.sq
stands for squared. Example: getDisMahalSq()
.stat
stands for statistics. Example: StatDRAM_type
.std
stands for standard deviation. Example: StdVec
.sym
stands for symmetric.symm
stands for symmetric.udf
stands for Unnormalized Density Function in the context of statistics. Example: getEggBoxLogUDF()
.uni
stands for univariate, mostly used in the context of statistical distributions. Example: DistUni_type
.unif
stands for uniform, mostly in the context of the uniform statistical distribution. Example: getUnifRand()
.upp
stands for upper triangle of a matrix or upper limits. Example: setChoUpp()
.vec
stands for vector. Example: stdVec
.The ParaMonte C++ library development and guidelines are summarized in CONTRIBUTING.md.
\brief
must always be the first line of the documentation of modules, types, and procedures.\details
, if it exists, must always immediately follow the Doxygen tag \brief
.\param
, if any number of it exists, must always immediately follow the Doxygen tag \brief
(or \details
if it exists).\return
, must be exclusively used to indicate the return value of functions.\param
tags. Example: runParaDRAMD().\interface
must appear immediately after the Doxygen \return
, \param
, \details
, or \brief
tags in the specified order, if any exists.\warning
, if any number of it exists, must immediately follow the Doxygen tag \return
if it exists, otherwise \param
if it exists, otherwise \details
if it exists, otherwise \brief
.\warning
tag must be used to highlight situations that require special attention of the user, otherwise, there is a danger for the code section being documented to not behave normally as one may expect.\attention
has the same functionality and usage as \warning
.\warning
should be preferred wherever \attention
is needed.\warning
also apply to the tag \attention
.\remark
, if any number of it exists, must immediately follow the Doxygen tag \warning
if it exists, otherwise the Doxygen tag \return
if it exists, otherwise \param
if it exists, otherwise \details
if it exists, otherwise \brief
.\remark
should be reserved for explaining behavior that is directly related to the code segment being documented, but its knowledge is not so critical as warrant the use of a \warning
tag.\note
, if it exists, must appear after all \warning
and \attention
and \remark
tags and immediately before the ParaMonte custom command tag \see
if it exists, otherwise immediately before \example
for examples (if it exists).\see
, if it exists, must appear after all \warning
and \remark
and \note
tags.\see
command exists, each must be written on a separate line and each line must end with the HTML line-break tag <br>
. Example: See below.\see
tag, otherwise after \note
, \remark
, \warning
, \param
, \details
, or \brief
if any exists.\example
devised in the config.txt
file of ParaMonte Doxygen documentation.\include
command, followed immediately by the ParaMonte custom Doxygen command \compile
which inserts the generic example compile commands for the example, followed optionally but immediately by the output file of the example inserted in the documentation via the \include
command, followed immediately by the inclusion of any other visualization or postprocessing scripts and output.\example
, otherwise, each empty line will start a new paragraph in the documentation.\test
tag, if any exists, must appear immediately after the example section designated by the \example
tag.\bug
tag, if any exists, must appear immediately after the \test
tag or any other tag immediately preceding it.\todo
tag, if any exists, must appear immediately after the \todo
tag or any other tag immediately preceding it.\final
separated from the tags before and after by an empty line.\xrefitem authors "Author" "Authors"
tag is the last command to appear in any documentation section, and it must preferably have the format exemplified in the example below.ParaMonte Doxygen custom commands.
To simplify documentation and avoid retyping certain frequently used keywords and sentences, a number of Doxygen aliases are predfined in the ParaMonte Doxygen config.txt
file. These include (but are not limited to):
\warnpure
Inserts a \warning
about procedures that are impure
when the library is built the preprocessor macro CHECK_ENABLED=1
.\elemental
Inserts a \remark
tag indicating that the procedure of interest is elemental
.\pure
Inserts a \remark
tag indicating that the procedure of interest is pure
.\interface
Starts a Possible calling interfaces paragraph where different calling interfaces of a procedure can be listed.\benchmark
Starts a new Benchmark paragraph which is hyper-linked to the generic anchor #benchmark
at the same location on the same page.\benchmark{xxx}
Starts a new Benchmark paragraph which is hyper-linked to the specific anchor #benchmark-xxx
at the same location on the same page.\benchmark{xxx, This is the benchmark title}
Starts a new Benchmark paragraph which is hyper-linked to the specific anchor #benchmark-xxx
at the same location on the same page with the title This is the benchmark title
.\example
Starts a new Example usage paragraph which is hyper-linked to the generic anchor #example
at the same location on the same page.\example{xxx}
Starts a new Example usage paragraph which is hyper-linked to the specific anchor #example-xxx
at the same location on the same page.\compile
Inserts the set of example compile commands.\output
Inserts a title line for the output section of an example paragraph.\postproc
Inserts a title line for the postprocessing section of an example paragraph.\abbr
Inserts a \remark
tag about the naming abbreviations used in the library.\naming
Inserts a \remark
tag about the naming conventions used in the library.\license
Inserts a \remark
tag about the generic licensing of the library.\final
Inserts the set of final generic remarks that should appear at the end of each documentation section. For an up-to-date list of all available aliases, check the value of the Doxygen ALIASES
option in config.txt
in the ParaMonte C++ documentation repository.
Escaping the Doxygen reserved characters.
Doxygen has a set of reserved characters whose usage in the documentation must be handled properly.
\
begins a Doxygen command.\\
.%
requires special care in some instances.For more information, see the relevant page on Doxygen documentation website.
\warning
, \remark
, \note
and other similar tags./// /// /// \ingroup pm_sampling /// /// \defgroup runParaDRAM runParaDRAM /// /// \brief /// Generate and return a non-zero value (`1`) if the procedure fails to fully accomplish the task of generating /// a Monte Carlo sample of the specified input mathematical objective function, otherwise, return `0`. /// /// \details /// This interface group is the entry point to all **C-style interfaces** to the ParaDRAM samplers of mathematical density functions.<br> /// Although the procedures of this generic interface return a single scalar of type `int32_t`, the procedures generate /// massive amounts of information about each simulation which are stored in appropriate external hard drive files.<br> /// /// See, /// <ol> /// <li> [this generic documentation page](\pmdoc_usage_sampling/paradram/output/) /// for more information on the generated output files for samplings performed using the [ParaDRAM](@ref runParaDRAM) sampler. /// </ol> /// /// \param[in] getLogFunc : The input user-specified procedure pointer to the natural logarithm of the target density function.<br> /// On input, the function must take an input vector `state` of size `ndim` of type floating-point of kind \C_RKALL /// representing a state (point) from within the domain of the user-specified target density function whose function value must be returned.<br> /// On output, the user-specified procedure `getLogFunc()` must return the function value corresponding to the input `state[ndim]`.<br> /// The following illustrate the generic interface of input function pointer `getLogFunc(state, ndim)`, /// \code{.F90} /// REAL getLogFunc(REAL[] state, int32_t ndim); /// \endcode /// where `REAL` can be a floating-point type of kind \C_RKALL for the corresponding varying-precision sampler interfaces:<br> /// <ol> /// <li> [runParaDRAMF](@ref runParaDRAMF), /// <li> [runParaDRAMD](@ref runParaDRAMD), /// <li> [runParaDRAML](@ref runParaDRAML). /// </ol> /// \param[in] ndim : The input scalar constant of type `int32_t` representing the number of dimensions of the domain of the objective function. /// \param[in] input : The input scalar pointer of type `char` representing the null-terminated C string /// that contains either, /// <ol> /// <li> the path to an external input file containing the namelist group of ParaDRAM sampler specifications /// as outlined in the corresponding page of [ParaMonte library generic documentation website](\pmdoc_usage_sampling/paradram/specifications/).<br> /// <li> the namelist group of ParaDRAM sampler specifications as the can appear in an external input specification file.<br> /// </ol> /// While all input simulation specifications are optional, it is highly recommended to pay /// attention to the default settings of the domain boundaries and sampler starting point.<br> /// (**optional**. It is considered as missing if set to `NULL`.) /// /// \return /// `stat` : The output scalar of type `int32_t` that is `0` **if and only if** /// the sampler succeeds in sampling the specified density function.<br> /// /// \interface{runParaDRAM} /// \code{.cpp} /// /// include "pm_sampling.hpp" /// /// stat = runParaDRAMF(getLogFunc, ndim, input) /// stat = runParaDRAMD(getLogFunc, ndim, input) /// stat = runParaDRAML(getLogFunc, ndim, input) /// /// \endcode /// /// \warning /// Beware that the definition of extended precision real type `long double` is compiler and platform dependent /// making the use of `long double` with precompiled ParaMonte libraries problematic and non-functional.<br> /// /// \warning /// The condition `0 < ndim` must hold for the corresponding input arguments.<br> /// \vericon /// /// \example{mvn} /// \include{lineno} example/pm_sampling/mvn/main.cpp /// \inputfile{mvn, input.nml, example specifications namelist input file} /// \include{lineno} example/pm_sampling/mvn/input.nml /// \cmakefile{mvn} /// \include{lineno} example/pm_sampling/mvn/CMakeLists.txt /// \cmakerun{mvn} /// \postproc{mvn} /// \include{lineno} example/pm_sampling/mvn/main.py /// \vis{mvn} /// \image html example/pm_sampling/mvn/mvn.traceplot.png width=700 /// \image html example/pm_sampling/mvn/mvn.scatterplot.png width=700 /// \image html example/pm_sampling/mvn/mvn.proposalAdaptation.png width=700 /// /// \example{himmelblau} /// \include{lineno} example/pm_sampling/himmelblau/main.cpp /// \inputfile{himmelblau, input.nml, example specifications namelist input file} /// \include{lineno} example/pm_sampling/himmelblau/input.nml /// \cmakefile{himmelblau} /// \include{lineno} example/pm_sampling/himmelblau/CMakeLists.txt /// \cmakerun{himmelblau} /// \postproc{himmelblau} /// \include{lineno} example/pm_sampling/himmelblau/main.py /// \vis{himmelblau} /// \image html example/pm_sampling/himmelblau/himmelblau.traceplot.png width=700 /// \image html example/pm_sampling/himmelblau/himmelblau.scatterplot.png width=700 /// \image html example/pm_sampling/himmelblau/himmelblau.proposalAdaptation.png width=700 /// /// \test /// [test_pm_sampling](@ref test_pm_sampling) /// /// \bug /// \status \unresolved /// \source \ifx{2024.0.0 20231017} /// \desc /// \ifx This interface yields a segmentation fault error for all `real` types supported when linked with the ParaMonte library built with \ifx. /// \remedy /// For now, only \ifort will be used.<br> /// /// \bug /// \status \unresolved /// \source \ifort{2021.11.0 20231010} /// \desc /// The `runParaDRAML` interface for `long double` yields a segmentation fault error. /// \remedy /// None as of today.<br> /// /// \todo /// \pvhigh /// The current tests for `long double` interface fail with \ifx and \icx compilers.<br> /// Apparently, there is a mismatch between `long double` and `c_long_double` storage.<br> /// This issue does not exist with GNU compilers, although the GNU definition of `long double` /// appears to yield incorrect values in some calculations, e.g., in `isFailedGeomCyclicFit()` of the ParaMonte library.<br> /// /// \todo /// \pmed /// This C-style interface should be ideally wrapped in a C++ template. /// /// \final{runParaDRAM} /// /// \author /// \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br> /// ///
\example
.The ParaMonte C++ library ships with ample example usage that are available in the example/cpp
folder in the root directory of the project repository.
These examples are also available and discussed in the documentations of individual modules and procedures of this this documentation website.
The best way to build and run the examples is to build the library to generate the final binary folder for your specific build.
This binary folder will contains the library along with all available example source codes and build instructions and scripts.
See the ParaMonte generic documentation for build and installation instructions on all supported platforms.
The ParaMonte C++ library currently does not ship with any benchmarks.
If you would like to see a relevant benchmark currently not included, discuss it here or raise an issue here for consideration or volunteer to implement it!