ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
Contents.m
Go to the documentation of this file.
1%> \mainpage
2%>
3%> \tableofcontents
4%>
5%> This is the <b>ParaMonte MATLAB</b> documentation website for the MATLAB users and developers.
6%>
7%> [⛓](#ParaMonte)
8%> <!--==============================-->
9%> \section ParaMonte What is ParaMonte?
10%> <!--==============================-->
11%>
12%> ParaMonte is a library of serial and parallel Monte Carlo and Machine Learning routines
13%> scientific inference, e.g., for sampling mathematical density functions of arbitrary-dimensions,
14%> with the design goal of unifying
15%>
16%> + the **automation** of simulations and inference,
17%> + the **user-friendliness** of the library and routines,
18%> + the **accessibility** from multiple programming environments,
19%> + the **high-performance** at runtime, and,
20%> + the **scalability** across many parallel processors.
21%>
22%> [⛓](#ParaMonteRepository)
23%> <!--==================================================-->
24%> \section ParaMonteRepository ParaMonte Project Repository
25%> <!--==================================================-->
26%>
27%> The ParaMonte library is open-source and is permanently located and maintained on **GitHub** at:
28%>
29%> &emsp;<a href="https://github.com/cdslaborg/paramonte" target="_blank"><b>https://github.com/cdslaborg/paramonte</b></a>
30%>
31%> [⛓](#ParaMonteReleases)
32%> <!--===============================================-->
33%> \section ParaMonteReleases ParaMonte Prebuilt Releases
34%> <!--===============================================-->
35%>
36%> The pre-built releases of the ParaMonte library for select configurations and compilers are available on **GitHub Release** page at:
37%>
38%> &emsp;<a href="https://github.com/cdslaborg/paramonte/releases" target="_blank"><b>https://github.com/cdslaborg/paramonte/releases</b></a>
39%>
40%> For instructions to build the ParaMonte library from source files, visit the ParaMonte library main documentation website [linked below](@ref ParaMonteDocumentation).
41%>
42%> [⛓](#ParaMonteDocumentation)
43%> <!--========================================================-->
44%> \section ParaMonteDocumentation ParaMonte Documentation Website
45%> <!--========================================================-->
46%>
47%> For information about the ParaMonte library in general and in other supported programming languages, visit:
48%>
49%> &emsp;<a href="https://www.cdslab.org/paramonte" target="_blank"><b>https://www.cdslab.org/paramonte</b></a>
50%>
51%> [⛓](#ParaMonteLangDocumentation)
52%> \section ParaMonteLangDocumentation ParaMonte MATLAB Documentation Website
53%>
54%> The documentation for the latest version of the ParaMonte MATLAB library is always <a href="../../matlab/latest/index.html" target="_blank"><b>available on this page</b></a>.<br>
55%>
56%> [⛓](#ParaMonteUsage)
57%> <!--=====================================-->
58%> \section ParaMonteUsage ParaMonte QuickStart
59%> <!--=====================================-->
60%>
61%> For more information on the installation, general usage, and examples, visit:
62%>
63%> &emsp;<a href="https://www.cdslab.org/paramonte" target="_blank"><b>https://www.cdslab.org/paramonte</b></a>
64%>
65%> To get started with the library once you download it, simply add the path to the ParaMonte library `+pm`
66%> package to access the routines and functionalities available in the library.<br>
67%>
68%> \code{.m}
69%>
70%> pmlibRootDir = './'; % Change this to the directory containing the ParaMonte MATLAB package `+pm`.
71%> addpath(pmlibRootDir);
72%> pm.lib.version();
73%> doc pm
74%>
75%> \endcode
76%>
77%> [⛓](#ParaMonteLangModules)
78%> \section ParaMonteLangModules ParaMonte MATLAB Library Modules
79%>
80%> The MATLAB equivalent of modules is called **package**.
81%> Similar to modules in other languages, MATLAB packages can be imported to the MATLAB environment
82%> or simply be used as namespace. For example,
83%>
84%> \code{.m}
85%> pm.lib.version()
86%> \endcode
87%>
88%> The ParaMonte MATLAB library currently contains a myriad of MATLAB *packages*.<br>
89%> The ParaMonte MATLAB library is currently under active development to extend the library functionalities to other tasks supported by the [ParaMonte Fortran library](../../../fortran/latest/index.html).<br>
90%> For a full list of all available functionalities and modules, see the [files listing](./files.html) and [class listing](./annotated.html) of this documentation website.<br>
91%>
92%> [⛓](#ParaMonteLangNamingConventions)
93%> \section ParaMonteLangNamingConventions ParaMonte MATLAB Naming Conventions
94%>
95%> + The **camelCase** naming style is enforced throughout the ParaMonte MATLAB library for all variable and function names.<br>
96%> + The **PascalCase** naming style is enforced throughout the ParaMonte MATLAB library for all class names.<br>
97%> In other words, **all class names begin with a capital letter**.<br>
98%>
99%> [⛓⛓](#ParaMonteLangNamingConventionsVariables)
100%> \subsection ParaMonteLangNamingConventionsVariables ParaMonte MATLAB Naming Conventions: Variables
101%>
102%> By convention in this library,
103%>
104%> + All variables and procedure names except compile-time constants begin with an lowercase letter.
105%>
106%> + All constants and parameters should generally be typed in uppercase.
107%>
108%> + The names of variables that **always** represent vectors of values **may** be suffixed with `Vec` or `Vector`.
109%>
110%> + The names of variables that **always** represent matrices of values **may** be suffixed with `Mat` or `Matrix`.
111%>
112%> + A significant attempt has been made to end all `logical` variables with a passive verb.<br>
113%> This is to ensure that the full variable name virtually forms a proposition.<br>
114%> In other words, a `logical` variable name should be an English-language statement that evaluates to either `true` or `false`.<br>
115%> For example, `parallelismMpiFinalizeEnabled` is one such proposition.<br>
116%> + Occasionally, names that begin with the verb `is` can also be used to label `logical` objects.<br>
117%> + But as a general rule, names that begin with a verb should be reserved for procedures.<br>
118%>
119%> [⛓⛓](#ParaMonteLangNamingConventionsProcedures)
120%> \subsection ParaMonteLangNamingConventionsProcedures ParaMonte MATLAB Naming Conventions: Procedures
121%>
122%> + Procedure names should be descriptive of the action performed by the procedure. For example,
123%>
124%> + `getCov` means *generate (a) covariance matrix*.
125%> + `setMatCopy` means *copy the matrix into the specified buffer*.
126%>
127%> + Procedure names should preferably begin with a lowercase verb.
128%>
129%> + **Exceptions** to the above and below rules are allowed when,
130%> + the procedure name is exceptionally famous, or
131%> + it is very inconvenient to prefix the procedure name with a verb.
132%>
133%> + The names of functions with return values should preferably begin with <b>`get`</b>.<br>
134%> The reasoning is simple: Functions in mathematics *generate and obtain* a **new** object instead of changing (resetting) the state of an existing object.<br>
135%> For example, the function `getMatSym(mat)` generates a symmetric version of the input matrix and returns it as the function result.<br>
136%> **Exceptions** to this naming convention are allowed, for example, when the `get` prefix is inconvenient or when the function returns a `logical` result.<br>
137%>
138%> + Functions that return objects of type `logical` should be preferably prefixed with `is` or
139%> be named such that the name begins with a verb and reads as a proposition, evaluating to
140%> either `.true.` or `.false.`.
141%>
142%> [⛓](#ParaMonteLangAbbreviationGuidlines)
143%> \section ParaMonteLangAbbreviationGuidlines ParaMonte MATLAB Abbreviation Guidelines
144%>
145%> The following list of abbreviations is in alphabetical order to enable faster search:
146%>
147%> + The abbreviation `avg` stands for **average** (rarely used).
148%> + The abbreviation `cdf` stands for **Cumulative Distribution Function** in the context of statistics. Example: `getNormCDF()`.
149%> + The abbreviation `cho` stands for **Cholesky factorization**. Example: `setChoLow()`.
150%> + The abbreviation `chol` stands for **Cholesky factorization**. Example: `setMatChol()`.
151%> + The abbreviation `cor` stands for **correlation**. Example: `getCor()`.
152%> + The abbreviation `cov` stands for **covariance**. Example: `getCov()`.
153%> + The abbreviation `cum` stands for **cumulative**. Example: `getCumSum()`.
154%> + The abbreviation `coef` stands for **coefficient**. Example: `corcoef_type()`.
155%> + The abbreviation `def` stands for **default** in variable names (mostly as a prefix `def_` or suffix `_def`).
156%> + The abbreviation `def` stands for **definite** (mostly in procedure names dealing with positive-definite matrices)
157%> + The abbreviation `den` stands for **density**, mostly in the context of statistical procedures and objects. Example: `getLogProbDen()`.
158%> + The abbreviation `det` stands for **determinant**, mostly in the context of Matrix and linear algebra. Example: `getMatDet()`.
159%> + The abbreviation `dia` stands for **diagonal**, mostly in the context of matrix algebra, matrix packing, or Cholesky factorization. Example: `dia_type()`.
160%> + The abbreviation `diag` stands for **diagonal**, mostly as dummy argument in matrix algebra procedures.
161%> + The abbreviation `desc` stands for **description**, mostly as a dummy argument in tests.
162%> + The abbreviation `diff` stands for **difference**. Example: `setDisSortedExpDiff()`.
163%> + The abbreviation `dist` stands for **distance** or **distribution** depending on the context. Example: `DistMulti_type`.
164%> + The abbreviation `eff` stands for **effective**. Example: `effSamSize`.
165%> + The abbreviation `exp` stands for **exponential** or **exponentiated**. Example: `setDisSortedExpDiff()`.
166%> + The abbreviation `hell` stands for **Hellinger** in statistical distance computations. Example: `getDisHellSq()`.
167%> + The abbreviation `herm` stands for **hermitian** in matrix algebra.
168%> + The abbreviation `ice` stands for **Internal Compiler Error**. It typically appears in the bug descriptions tagged via Doxygen command <tt>\\bug</tt>.
169%> + The abbreviation `inv` stands for **inverse**. Example: `getMatInv()`.
170%> + The abbreviation `ks` stands for **Kolmogorov-Smirnov** test. Example: `getProbKS()`.
171%> + The abbreviation `lin` stands for **linear**. Example: `getLinSpace()`.
172%> + The abbreviation `low` stands for **lower triangle of a matrix** or **lower limits**. Example: `setChoLow()`.
173%> + The abbreviation `mahal` stands for **Mahalanobis** distance. Example: `getDisMahalSq()`.
174%> + The abbreviation `mat` stands for **matrix**. Example: `getMatInv()`.
175%> + The abbreviation `multi` stands for **multivariate** mostly used in the context of statistical distributions. Example: `getMultiNormRand()`.
176%> + The abbreviation `msn` stands for **Multivariate Skew-Normal** mostly used in the context of the statistical MultiVariate Skew-Normal distribution.
177%> + The abbreviation `mvn` stands for **MultiVariate Normal** mostly used in the context of the statistical MultiVariate Normal distribution.
178%> + The abbreviation `mvu` stands for **MultiVariate Uniform** mostly used in the context of the statistical MultiVariate (ellipsoidal) Uniform distribution.
179%> + The abbreviation `norm` stands for **normal** in the context of statistical distributions or **normalization** factor. Example: `DistMultiNorm_type`.
180%> + The abbreviation `normed` stands for **normalized** mostly in the context of statistical samples. Example: `NormedSample`.
181%> + The abbreviation `pdf` stands for **Probability Density Function** in the context of statistics. Example: `getNormLogPDF()`.
182%> + The abbreviation `pos` stands for **positive**. Example: `getInvPosDefMat()`.
183%> + The abbreviation `prob` stands for `probability`, mostly in the context of statistical applications. Example: `getLogProb()`.
184%> + The abbreviation `proc` stands for `procedure`, particularly, when it appears as the suffix `_proc` in `abstract interface` definitions.
185%> + The abbreviation `quan` stands for **quantile**, mostly in the context of statistics. Example: `getParetoLogQuan()`.
186%> + The abbreviation `rand` stands for **random**, mostly in the context of statistics. Example: `getUnifRand()`.
187%> + The abbreviation `ref` stands for **reference**, mostly in the context of testings to represent the reference values for comparison. Example: `mean_ref`.
188%> + The abbreviation `sam` stands for **sample**, mostly in the context of statistics. Example: `effSamSize`.
189%> + The abbreviation `sq` stands for **squared**. Example: `getDisMahalSq()`.
190%> + The abbreviation `stat` stands for **statistics**. Example: `StatDRAM_type`.
191%> + The abbreviation `std` stands for **standard deviation**. Example: `StdVec`.
192%> + The abbreviation `sym` stands for **symmetric**.
193%> + The abbreviation `symm` stands for **symmetric**.
194%> + The abbreviation `udf` stands for **Unnormalized Density Function** in the context of statistics. Example: `getEggBoxLogUDF()`.
195%> + The abbreviation `uni` stands for **univariate**, mostly used in the context of statistical distributions. Example: `DistUni_type`.
196%> + The abbreviation `unif` stands for **uniform**, mostly in the context of the uniform statistical distribution. Example: `getUnifRand()`.
197%> + The abbreviation `upp` stands for **upper triangle of a matrix** or **upper limits**. Example: `setChoUpp()`.
198%> + The abbreviation `vec` stands for **vector**. Example: `stdVec`.
199%>
200%> [⛓](#ParaMonteLangDeveloperWarnings)
201%> \section ParaMonteLangDeveloperWarnings ParaMonte MATLAB Developer Guidelines and Warnings
202%>
203%> The ParaMonte MATLAB library development and guidelines are summarized in
204%> <a href="https://github.com/cdslaborg/paramonte/blob/main/src/matlab/CONTRIBUTING.md" target="_blank">CONTRIBUTING.md</a>.
205%>
206%> [⛓](#ParaMonteLangDocumentationGuidelines)
207%> \section ParaMonteLangDocumentationGuidelines ParaMonte MATLAB Documentation Guidelines
208%>
209%> + **Doxygen custom command orderings**.
210%>
211%> + The Doxygen tag `\brief` must always be the first line of the documentation of modules, types, and procedures.<br>
212%> Example: [+sampling/@Paradram/Paradram](@ref +sampling/@Paradram/Paradram).<br>
213%> + The Doxygen tag `\details`, if it exists, must always immediately follow the Doxygen tag `\brief`.<br>
214%> Example: [+sampling/@Paradram/Paradram](@ref +sampling/@Paradram/Paradram).<br>
215%> + The Doxygen tag `\param`, if any number of it exists, must always immediately follow the Doxygen tag `\brief` (or `\details` if it exists).<br>
216%> Example: [runParaDRAMD()](@ref +sampling/@Paradram/Paradram::runParaDRAMD).<br>
217%> + The Doxygen tag `\return`, must be exclusively used to indicate the return value of functions.<br>
218%> If it exists, it must appear immediately after the set of `\param` tags. Example: [runParaDRAMD()](@ref +sampling/@Paradram/Paradram::runParaDRAMD).<br>
219%> + If a generic interface is being documented, the ParaMonte custom command <tt>\\interface</tt> must appear immediately
220%> after the Doxygen `\return`, `\param`, `\details`, or `\brief` tags in the specified order, if any exists.<br>
221%> + The Doxygen tag `\warning`, if any number of it exists, must immediately follow the Doxygen tag `\return` if it exists,
222%> otherwise `\param` if it exists, otherwise `\details` if it exists, otherwise `\brief`.<br>
223%> The `\warning` tag must be used to highlight situations that require special attention of the user,
224%> otherwise, there is a danger for the code section being documented to not behave normally as one may expect.<br>
225%> + The Doxygen tag `\attention` has the same functionality and usage as `\warning`.<br>
226%> Therefore, `\warning` should be preferred wherever `\attention` is needed.<br>
227%> Exceptions are allowed and if they occur, the same documentation conventions as those of `\warning` also apply to the tag `\attention`.<br>
228%> + The Doxygen tag `\remark`, if any number of it exists, must immediately follow the Doxygen tag `\warning` if it exists,
229%> otherwise the Doxygen tag `\return` if it exists, otherwise `\param` if it exists, otherwise `\details` if it exists, otherwise `\brief`.<br>
230%> The tag `\remark` should be reserved for explaining behavior that is **directly** related to the code segment being documented,
231%> but its knowledge is not so critical as warrant the use of a `\warning` tag.<br>
232%> + The Doxygen tag `\note`, if it exists, must appear after all `\warning` and `\attention` and `\remark` tags and
233%> immediately before the ParaMonte custom command tag `\see` if it exists, otherwise immediately before <tt>\\example</tt> for examples (if it exists).<br>
234%> + The Doxygen tag `\see`, if it exists, must appear after all `\warning` and `\remark` and `\note` tags.<br>
235%> If more than one item for the `\see` command exists, each must be written on a separate line and each line must end with the HTML line-break tag `<br>`.
236%> Example: See [below](#example-ParaMonteLangDocumentationGuidelines).<br>
237%> + If any example exists, it must appear immediately after the `\see` tag, otherwise after `\note`, `\remark`, `\warning`, `\param`, `\details`, or `\brief` if any exists.<br>
238%> ParaMonte examples are initiated by the custom command <tt>\\example</tt> devised in the `config.txt` file of ParaMonte Doxygen documentation.<br>
239%> If the example exists in an external file, then it must be included via the Doxygen `\include` command, followed immediately by
240%> the ParaMonte custom Doxygen command <tt>\\compile</tt> which inserts the generic example compile commands for the example, followed optionally
241%> but immediately by the output file of the example inserted in the documentation via the `\include` command, followed immediately by the inclusion
242%> of any other visualization or postprocessing scripts and output.<br>
243%> <b>In all steps, it is imperative to not leave any empty lines between the successive commands of the example
244%> section</b>, designated by the <tt>\\example</tt>, otherwise, each empty line will start a new paragraph in the documentation.<br>
245%> Example: See [below](#example-ParaMonteLangDocumentationGuidelines).<br>
246%> + The Doxygen `\test` tag, if any exists, must appear immediately after the example section designated by the <tt>\\example</tt> tag.<br>
247%> + The Doxygen `\todo` tag, if any exists, must appear immediately after the `\test` tag or any other tag immediately preceding it.<br>
248%> + The Doxygen `\bug` tag, if any exists, must appear immediately after the `\todo` tag or any other tag immediately preceding it.<br>
249%> + The closing command of each documentation section must be the ParaMonte custom command <tt>\\final</tt> separated from the tags before and after by an empty line.<br>
250%> + The Doxygen `\author` tag is the last command to appear in any documentation section, and it must preferably have the format exemplified in the example below.<br>
251%> <br>
252%> <br>
253%>
254%> + **ParaMonte Doxygen custom commands**.<br>
255%> To simplify documentation and avoid retyping certain frequently used keywords and sentences, a number of Doxygen aliases are predfined
256%> in the ParaMonte Doxygen `config.txt` file. These include (but are not limited to):
257%> + <tt>\\warnpure</tt> Inserts a `\warning` about procedures that are `impure` when the library is built the preprocessor macro `CHECK_ENABLED=1`.
258%> + <tt>\\elemental</tt> Inserts a `\remark` tag indicating that the procedure of interest is `elemental`.
259%> + <tt>\\pure</tt> Inserts a `\remark` tag indicating that the procedure of interest is `pure`.
260%> + <tt>\\interface</tt> Starts a **Possible calling interfaces** paragraph where different calling interfaces of a procedure can be listed.
261%> + <tt>\\benchmark</tt> Starts a new **Benchmark** paragraph which is hyper-linked to the generic anchor `#benchmark` at the same location on the same page.
262%> + <tt>\\benchmark{xxx}</tt> Starts a new **Benchmark** paragraph which is hyper-linked to the specific anchor `#benchmark-xxx` at the same location on the same page.
263%> + <tt>\\benchmark{xxx, This is the benchmark title}</tt> Starts a new **Benchmark** paragraph which is hyper-linked to
264%> the specific anchor `#benchmark-xxx` at the same location on the same page with the title `This is the benchmark title`.
265%> + <tt>\\example</tt> Starts a new **Example usage** paragraph which is hyper-linked to the generic anchor `#example` at the same location on the same page.
266%> + <tt>\\example{xxx}</tt> Starts a new **Example usage** paragraph which is hyper-linked to the specific anchor `#example-xxx` at the same location on the same page.
267%> + <tt>\\compile</tt> Inserts the set of example compile commands.
268%> + <tt>\\output</tt> Inserts a title line for the output section of an example paragraph.
269%> + <tt>\\postproc</tt> Inserts a title line for the postprocessing section of an example paragraph.
270%> + <tt>\\abbr</tt> Inserts a `\remark` tag about the naming abbreviations used in the library.
271%> + <tt>\\naming</tt> Inserts a `\remark` tag about the naming conventions used in the library.
272%> + <tt>\\license</tt> Inserts a `\remark` tag about the generic licensing of the library.
273%> + <tt>\\final</tt> Inserts the set of final generic remarks that should appear at the end of each documentation section.
274%> + <tt>\\RK</tt> Inserts a hyper-link reference \RK to the default `real` kind used in the library.
275%> + <tt>\\RK32</tt> Inserts a hyper-link reference \RK32 to the `real32` real kind used in the library.
276%> + <tt>\\RK64</tt> Inserts a hyper-link reference \RK64 to the `real64` real kind used in the library.
277%> + <tt>\\RK128</tt> Inserts a hyper-link reference \RK128 to the `real128` real kind used in the library.
278%> + <tt>\\CK</tt> Inserts a hyper-link reference \CK to the default `complex` kind used in the library.
279%> + <tt>\\CK32</tt> Inserts a hyper-link reference \CK32 to the `real32` complex kind used in the library.
280%> + <tt>\\CK64</tt> Inserts a hyper-link reference \CK64 to the `real64` complex kind used in the library.
281%> + <tt>\\CK128</tt> Inserts a hyper-link reference \CK128 to the `real128` complex kind used in the library.
282%> + <tt>\\IK8</tt> Inserts a hyper-link reference \IK8 to the `int8` integer kind used in the library.
283%> + <tt>\\IK16</tt> Inserts a hyper-link reference \IK16 to the `int16` integer kind used in the library.
284%> + <tt>\\IK32</tt> Inserts a hyper-link reference \IK32 to the `int32` integer kind used in the library.
285%> + <tt>\\IK64</tt> Inserts a hyper-link reference \IK64 to the `int64` integer kind used in the library.
286%> + <tt>\\SKALL</tt> Inserts a hyper-link reference to all major `character` kinds like: \SKALL.
287%> + <tt>\\IKALL</tt> Inserts a hyper-link reference to all major `integer` kinds like: \IKALL.
288%> + <tt>\\LKALL</tt> Inserts a hyper-link reference to all major `logical` kinds like: \LKALL.
289%> + <tt>\\CKALL</tt> Inserts a hyper-link reference to all major `complex` kinds like: \CKALL.
290%> + <tt>\\RKALL</tt> Inserts a hyper-link reference to all major `real` kinds like: \RKALL.
291%> <br>
292%> <br>
293%>
294%> For an up-to-date list of all available aliases, check the value of the Doxygen `ALIASES` option in `config.txt` in the ParaMonte MATLAB documentation repository.
295%>
296%> + **Escaping the Doxygen reserved characters**.<br>
297%> Doxygen has a set of reserved characters whose usage in the documentation must be handled properly.<br>
298%> + Most importantly, the backslash character `\` begins a Doxygen command.<br>
299%> To print a backslash character to the output one should escape it via `\\`.<br>
300%> + Also, the use of the percentage symbol `%` requires special care in some instances.<br>
301%> This is particularly important when defining Windows environment variables that should typically be enclosed with percentage character.<br>
302%> <br>
303%>
304%> For more information, see [the relevant page on Doxygen documentation website](https://www.doxygen.nl/manual/commands.html#cmdfdollar).
305%> <br>
306%>
307%> + Avoid the insertion of an empty documentation line between any two lines of a single Doxygen paragraph.<br>
308%> This is crucial when the whole paragraph is indented by a vertical line as is done by Doxygen for `\warning`, `\remark`, `\note` and other similar tags.<br>
309%> \example{ParaMonteLangDocumentationGuidelines}
310%> The following is an example documentation for a procedure:
311%> \verbatim
312%>
313%> \brief
314%> This is the ParaDRAM class for generating instances of serial and parallel
315%> Delayed-Rejection Adaptive Metropolis-Hastings Markov Chain Monte Carlo
316%> sampler of the ParaMonte MATLAB library.<br>
317%>
318%> \brief
319%> Once you assign the desired simulation specifications to the corresponding
320%> attributes within the component `spec` of an object of class [pm.sampling.Paradram](@ref Paradram),
321%> call the ParaDRAM sampler via the object method [pm.sampling.Paradram.run()](@ref Paradram::run).<br>
322%>
323%> While the constructor of this class does not take any input arguments,
324%> all ParaDRAM simulation specifications can be set after creating the object.<br>
325%>
326%> \return
327%> ``sampler`` : The output scalar object of class [pm.sampling.Paradram](@ref Paradram).<br>
328%>
329%> \interface{Paradram}
330%> \code{.m}
331%>
332%> sampler = pm.sampling.Paradram();
333%>
334%> \endcode
335%>
336%> \warning
337%> When using the ParaMonte MATLAB library functionalities, particularly ParaMonte samplers in parallel,
338%> it would be best to close any such aggressive software/applications as Dropbox, ZoneAlarm, ...
339%> that interfere with your ParaMonte MATLAB library output files, potentially causing the tasks
340%> to fail and crash before successful completion.<br>
341%> These situations happen only scarcely.<br>
342%>
343%> \note
344%> On Windows systems, when restarting an old interrupted ParaDRAM simulation,
345%> ensure your MATLAB session is also restarted before the simulation restart.<br>
346%> This may be needed as Windows sometimes locks access to some or all of the simulation output files.<br>
347%>
348%> \note
349%> To unset an already-set input simulation specification, simply set the
350%> simulation attribute to empty double `[]` or re-instantiate the object.<br>
351%>
352%> \see
353%> [ParaDRAM simulation specifications listing](\pmdoc_usage_sampling/paradram/specifications/)<br>
354%> [ParaDRAM simulation restart functionality](\pmdoc_usage_sampling/paradram/restart/)<br>
355%> [ParaDRAM simulation output files](\pmdoc_usage_sampling/paradram/output/)<br>
356%>
357%> Example Usage: Serial
358%> ---------------------
359%>
360%> First, ensure the ParaMonte ``+pm`` package (i.e., folder) is available in your MATLAB paths.
361%>
362%> Here is a MATLAB script ``main.m`` for a serial ParaDRAM simulation.<br>
363%> Copy and paste the following code into your MATLAB session:<br>
364%>
365%> \code{.m}
366%>
367%> sampler = pm.sampling.Paradram();
368%> sampler.run ( @(x) - sum(x.^2) ... getLogFunc: the natural log of the objective function.
369%> , 4 ... ndim: the number of dimensions of the objective function.
370%> );
371%> samples = sampler.readSample();
372%> sample = samples{1};
373%> tile = pm.vis.TileLine(sample.df);
374%> tile.make("coly", sample.sampleLogFuncColIndex + 1 : sample.sampleLogFuncColIndex + 4, "colc", "sampleLogFunc");
375%>
376%> \endcode
377%>
378%> The mathematical objective function in the above example is a
379%> is a multivariate Normal distribution centered at the origin,
380%> whose natural logarithm is returned by the lambda (``Anonymous``)
381%> function defined as a function handle input to the ParaDRAM sampler.<br>
382%>
383%> Running this code will generate a set of simulation output files (in the current working directory of MATLAB).<br>
384%> Among these, the file suffixed with "_report.txt" contains the full description of all input specifications
385%> of the ParaDRAM simulation as well as other information about the simulation results.<br>
386%>
387%> Example Usage: Thread-Parallel
388%> ------------------------------
389%>
390%> First, ensure the ParaMonte ``+pm`` package (i.e., folder) is available in your MATLAB paths.<br>
391%>
392%> Threading parallelism is possible as of ParaMonte MATLAB version ``3.0.0``.<br>
393%> However, only ``singleChain`` ParaDRAM simulations are supported.<br>
394%>
395%> Here is a MATLAB script ``main.m`` for a thread-parallel ParaDRAM simulation.<br>
396%> Copy and paste the following code and paste into your MATLAB session:<br>
397%>
398%> \code{.m}
399%>
400%> sampler = pm.sampling.Paradram();
401%> sampler.spec.parallelismNumThread = 0; % use all available threads.
402%> sampler.run ( @(x) - sum(x.^2) ... getLogFunc: the natural log of the objective function.
403%> , 4 ... ndim: the number of dimensions of the objective function.
404%> );
405%> samples = sampler.readSample();
406%> sample = samples{1};
407%> pm.vis.tile(sample.contents)
408%>
409%> \endcode
410%>
411%> The mathematical objective function in the above example is a
412%> is a multivariate Normal distribution centered at the origin,
413%> whose natural logarithm is returned by the lambda (``Anonymous``)
414%> function defined as a function handle input to the ParaDRAM sampler.<br>
415%>
416%> Running this code will generate a set of simulation output files (in the current working directory of MATLAB).<br>
417%> Among these, the file suffixed with ``"_report.txt"`` contains the full description of all input specifications
418%> of the ParaDRAM simulation as well as other information about the simulation results.<br>
419%>
420%> Specifying ``0`` as the number of threads will lead to using
421%> all available CPU threads for thread-parallel ParaDRAM simulation.<br>
422%>
423%> \note
424%> **Benefits of thread-parallelism**<br>
425%> Thread-parallel simulations offer a much more flexible
426%> and easier approach to benefiting from parallelism without
427%> going through the hassle of MPI-parallel simulations.<br>
428%> But they can still potentially offer much faster speed than serial simulations.<br>
429%> The actual speedup depends on a lot of factors.<br>
430%> Moreover, the number of threads is limited to maximum
431%> number of physical cores available on your system.<br>
432%> As such, thread-parallel simulations are not scalable.<br>
433%> If you need scalability, checkout MPI-parallelism below.<br>
434%>
435%> Example Usage: MPI-Parallel
436%> ---------------------------
437%>
438%> First, ensure the ParaMonte ``+pm`` package (i.e., folder) is available in your MATLAB paths.<br>
439%>
440%> MPI-parallel simulations can be slightly more cumbersome than thread-parallel simulations
441%> described above because MPI-parallel simulations cannot be performed from within a MATLAB GUI
442%> session and require launching MATLAB via a compatible ``mpiexec`` launcher.<br>
443%>
444%> <ol>
445%> <li> Ensure you need and will get a speedup by running the an MPI-parallel simulation.<br>
446%> Typically, your simulation may then benefit from parallelism only if a single
447%> evaluation of the objective function takes longer than a few milliseconds.<br>
448%>
449%> <li> Ensure the required MPI libraries are installed on your system
450%> (You can skip this step if you know that you already have
451%> a compatible MPI library installed on your system).<br>
452%> On the MATLAB command line type the following,<br>
453%> \code{.m}
454%> pm.lib.verify();
455%> \endcode
456%> This will verify the existence of a valid MPI library on your system and,
457%> if missing, will guide you to install the MPI library on your system.<br>
458%>
459%> <li> Once the MPI installation is verified, copy and paste the following
460%> code into your MATLAB session:
461%> \code{.m}
462%>
463%> fid = fopen("main_mpi.m", "w");
464%> sourceCode = ...
465%> "sampler = pm.sampling.Paradram();" + newline + ...
466%> "sampler.mpiname = pm.lib.mpi.choice();" + newline + ...
467%> "sampler.run( @(x) - sum(x.^2) ... getLogFunc: the natural log of the objective function." + newline + ...
468%> " , 4 ... ndim: the number of dimensions of the objective function" + newline + ...
469%> " );";
470%> fprintf(fid, "%s\n", sourceCode);
471%> fclose(fid);
472%>
473%> \endcode
474%>
475%> <li> This will generate a ``main_mpi.m`` MATLAB script file in the current working directory of your MATLAB session.<br>
476%> Now, you can execute this MATLAB script file (``main_mpi.m``) in parallel.<br>
477%> To do so, you need to call MATLAB on a command-line, **out of MATLAB GUI**.<br>
478%> <ol>
479%> <li> **On Windows**:<br>
480%> From within command prompt that recognizes both MATLAB and ``mpiexec``,
481%> ideally, the Intel dedicated command-prompt that is shipped with Intel MPI library,
482%> type the following,
483%> \code{.m}
484%>
485%> mpiexec -localonly -n 3 matlab -batch "main_mpi"
486%>
487%> \endcode
488%>
489%> \note
490%> In the above MPI launcher command for Windows OS,
491%> we assumed that you would be using the Intel MPI library, hence,
492%> the reason for the extra flag ``-localonly``.<br>
493%> This flag runs the parallel code only on one node, but in doing so,
494%> it avoids the use of Hydra service and its registration.<br>
495%> If you are not on a Windows cluster, (e.g., you are using your personal device),
496%> then we recommend specifying this flag.<br>
497%>
498%> <li> **On macOS/Linux**:<br>
499%> From within a Bash terminal that recognizes both MATLAB and ``mpiexec``,
500%> type the following,
501%> \code{.m}
502%>
503%> mpiexec -n 3 matlab -batch "main_mpi"
504%>
505%> \endcode
506%>
507%> \note
508%> In both cases in the above, the script ``main_mpi.m`` will run on 3 processors.<br>
509%> Feel free to change the number of processors to any number desired.<br>
510%> But do not request more than the available number of physical cores on your system.<br>
511%> </ol>
512%> </ol>
513%>
514%> \warning
515%> Do not add postprocessing codes (such as reading and plotting the output samples) in your MPI-parallel code.<br>
516%> There is no point in doing so, since MATLAB will run in ``-batch`` mode for parallel simulations, disabling all plotting capabilities.<br>
517%> Moreover, if you read and postprocess the output files in parallel mode, the task will be done
518%> by all parallel processes, potentially overwriting external IO activities of each other.<br>
519%> Only perform the sampling as described above in MPI-parallel mode.<br>
520%>
521%> ParaDRAM Simulation Specifications
522%> ----------------------------------
523%>
524%> The ParaDRAM simulation specifications have lengthy comprehensive descriptions
525%> that appear in full in the output report files of every ParaDRAM simulation.<br>
526%>
527%> The best way to learn about individual ParaDRAM simulation attributes
528%> is to a run a minimal serial simulation as given in the above.<br>
529%> You can also use the ``sampler.spec.doc()`` method:
530%>
531%> \code{.m}
532%> sampler = pm.sampling.Paradram();
533%> sampler.spec.doc();
534%> \endcode
535%>
536%> \final{Paradram}
537%>
538%> \author
539%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin
540%>
541%> \endverbatim
542%> <br>
543%> The above example documentation snippet will generate [an HTML similar to this documentation](@ref Paradram).<br>
544%> Note the lack of an empty line among the commands that immediately follow <tt>\\example</tt>.<br>
545%> This is essential to keep the entire example section in the same paragraph.
546%>
547%> <br>
548%>
549%> [⛓](#ParaMonteLangExamples)
550%> \section ParaMonteLangExamples ParaMonte MATLAB Language Examples
551%>
552%> The ParaMonte MATLAB library ships with tens of thousands of example usage that are available in the `example/matlab` folder in the [root directory of the project repository](https://github.com/cdslaborg/paramonte).<br>
553%> These examples are also available and discussed in the documentations of individual modules and procedures of this this documentation website.<br>
554%>
555%> [⛓](#ParaMonteLangBenchmarks)
556%> \section ParaMonteLangBenchmarks ParaMonte MATLAB Language Benchmarks
557%>
558%> The ParaMonte MATLAB library currently does not ship with any benchmarks.<br>
559%> If you would like to see a relevant benchmark currently not included, [discuss it here](https://github.com/cdslaborg/paramonte/discussions)
560%> or [raise an issue here](https://github.com/cdslaborg/paramonte/issues) for consideration or volunteer to implement it!<br>
561%>
562%> [⛓](#ParaMonteLangDocumentationTroubleshooting)
563%> \section ParaMonteLangDocumentationTroubleshooting ParaMonte MATLAB Documentation Troubleshooting
564%>
565%> <ol>
566%> <li> **Side navigation pane disappears in some documentation pages.**<br>
567%> This issue most likely originates from the interference of browser addons with the documentation.<br>
568%> This issue is mostly observed on Firefox browsers.<br>
569%> If it occurs, open the page in *browser private mode* or use other (e.g., chrome-based) browsers.<br>
570%> </ol>
571%>
572%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
573%
function verify(in varval, in vartype, in varsize, in varname)
Verify the type and number of elements of the input varval match the specified input vartype and vars...
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared libraries.
function list()
Return a list of MATLAB strings containing the names of OS platforms supported by the ParaMonte MATLA...
function index(in array)
Given array(1 : n), return the array index indx(1 : n) such that array(indx) is in ascending order.
function version(in silent)
Return a scalar MATLAB string containing the latest available ParaMonte MATLAB version newer than the...
This is the ParaDRAM class for generating instances of serial and parallel Delayed-Rejection Adaptive...
Definition: Paradram.m:14
function copy(in from, in to, in fields)
Copy the contents of the struct/object from to the struct/object to recursively and without destroyin...
function getLogFunc(in point)
function href(in url)
Return an HTML-style decoration of the input URL if the ParaMonte MATLAB library is used in GUI,...
function inv(in cholow)
Generate and return the inverse of a positive-definite matrix whose Lower-triangular Cholesky factori...
function lin()
Return true if the current OS is Linux.
function parallel()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.
function statistics()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...