ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
SpecMCMC.m
Go to the documentation of this file.
1%> \brief
2%> This is the base class for the ParaMonte sampler MCMC specifications.<br>
3%> This is an abstract class that is not meant to be used by the user.<br>
4%> See the class constructor.<br>
5%>
6%> \note
7%> All class attributes can be set after constructing an instance of this class.<br>
8%>
9%> \note
10%> See below for information on the methods.<br>
11%>
12%> \final{SpecMCMC}
13%>
14%> \author
15%> \JoshuaOsborne, May 21 2024, 12:54 AM, University of Texas at Arlington<br>
16%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
17%> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
18classdef SpecMCMC < pm.sampling.SpecBase
19
20 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
21
22 properties
23 %> \specdram{outputchainsize}
24 outputChainSize = [];
25 %> \specdram{outputsamplerefinementcount}
26 outputSampleRefinementCount = [];
27 %> \specdram{outputsamplerefinementmethod}
28 outputSampleRefinementMethod = [];
29 %> \specdram{proposal}
30 proposal = [];
31 %> \specdram{proposalcor}
32 proposalCor = [];
33 %> \specdram{proposalcov}
34 proposalCov = [];
35 %> \specdram{proposalscale}
36 proposalScale = [];
37 %> \specdram{proposalstart}
38 proposalStart = [];
39 %> \specdram{proposalstartdomaincubelimitlower}
40 proposalStartDomainCubeLimitLower = [];
41 %> \specdram{proposalstartdomaincubelimitupper}
42 proposalStartDomainCubeLimitUpper = [];
43 %> \specdram{proposalstartrandomized}
44 proposalStartRandomized = [];
45 %> \specdram{proposalstd}
46 proposalStd = [];
47 end
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
50
51 methods(Access = public)
52 %> \brief
53 %> Construct and return an object of class [pm.sampling.SpecMCMC](@ref SpecMCMC).<br>
54 %>
55 %> \param[in] method : The input scalar MATLAB string containing
56 %> the name of the specific ParaMonte sampler
57 %> whose simulation specifications are to be
58 %> stored in the output of this constructor.<br>
59 %> \param[in] silent : The input scalar MATLAB logical.<br>
60 %> If ``true``, all descriptive messages on
61 %> the MATLAB command line will be suppressed.<br>
62 %> (**optional**, default = ``false``)
63 %>
64 %> \return
65 %> The output scalar object of class [pm.sampling.SpecMCMC](@ref SpecMCMC).<br>
66 %>
67 %> \interface{SpecMCMC}
68 %> \code{.m}
69 %>
70 %> spec = pm.sampling.SpecMCMC()
71 %> spec = pm.sampling.SpecMCMC([])
72 %> spec = pm.sampling.SpecMCMC([], [])
73 %> spec = pm.sampling.SpecMCMC(method)
74 %> spec = pm.sampling.SpecMCMC(method, [])
75 %> spec = pm.sampling.SpecMCMC([], silent)
76 %> spec = pm.sampling.SpecMCMC(method, silent)
77 %>
78 %> \endcode
79 %>
80 %> \final{SpecMCMC}
81 %>
82 %> \author
83 %> \JoshuaOsborne, May 21 2024, 12:58 AM, University of Texas at Arlington<br>
84 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
85 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
86 function self = SpecMCMC(method, silent)
87 if nargin < 2
88 silent = [];
89 end
90 if nargin < 1
91 method = "ParaMCMC";
92 end
93 self = self@pm.sampling.SpecBase(method, silent);
94 end
95
96 end
97
98 methods(Hidden)
99 %> \brief
100 %> Ensure all specification properties of the parent object are sensible.<br>
101 %>
102 %> \details
103 %> This is a dynamic method of the class [pm.sampling.SpecMCMC](@ref SpecMCMC).<br>
104 %>
105 %> \param[in] self : The input parent object of class [pm.sampling.SpecMCMC](@ref SpecMCMC)
106 %> which is **implicitly** passed to this dynamic method (not by the user).<br>
107 %> \param[in] ndim : The input scalar MATLAB integer containing
108 %> the number of dimensions of the domain of the
109 %> object function that is to be explored.<br>
110 %>
111 %> \return
112 %> ``entries`` : The output scalar MATLAB string containing
113 %> the simulation specifications converted to
114 %> a Fortran-namelist-compatible entry.<br>
115 %>
116 %> \interface{getEntriesNML}
117 %> \code{.m}
118 %>
119 %> entries = self.getEntriesNML(ndim)
120 %>
121 %> \endcode
122 %>
123 %> \final{getEntriesNML}
124 %>
125 %> \author
126 %> \JoshuaOsborne, May 21 2024, 1:01 AM, University of Texas at Arlington<br>
127 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
128 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin<br>
129 function entries = getEntriesNML(self, ndim)
130
131 entries = getEntriesNML@pm.sampling.SpecBase(self, ndim);
132
133 %%%%
134 %%%% The NML entry ``proposalScale`` must be a string, but could also be implicitly converted to string if it is a real number.
135 %%%%
136
137 if isreal(self.proposalScale)
138 self.proposalScale = string(self.proposalScale);
139 end
140
141 %%%%
142 %%%% Verify the rest of the NML entries.
143 %%%%
144
145 if ~isempty(self.outputChainSize ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("outputChainSize ", self.outputChainSize , "integer" , 1) ; end
146 if ~isempty(self.outputSampleRefinementCount ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("outputSampleRefinementCount ", self.outputSampleRefinementCount , "integer" , 1) ; end
147 if ~isempty(self.outputSampleRefinementMethod ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("outputSampleRefinementMethod ", self.outputSampleRefinementMethod , "string" , 1) ; end
148 if ~isempty(self.proposal ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposal ", self.proposal , "string" , 1) ; end
149 if ~isempty(self.proposalCor ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalCor ", self.proposalCor , "real" , ndim^2) ; end
150 if ~isempty(self.proposalCov ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalCov ", self.proposalCov , "real" , ndim^2) ; end
151 if ~isempty(self.proposalScale ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalScale ", self.proposalScale , "string" , 1) ; end
152 if ~isempty(self.proposalStart ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalStart ", self.proposalStart , "real" , ndim) ; end
153 if ~isempty(self.proposalStartDomainCubeLimitLower ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalStartDomainCubeLimitLower", self.proposalStartDomainCubeLimitLower , "real" , ndim) ; end
154 if ~isempty(self.proposalStartDomainCubeLimitUpper ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalStartDomainCubeLimitUpper", self.proposalStartDomainCubeLimitUpper , "real" , ndim) ; end
155 if ~isempty(self.proposalStartRandomized ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalStartRandomized ", self.proposalStartRandomized , "logical" , 1) ; end
156 if ~isempty(self.proposalStd ); entries = entries + self.nmlsep + pm.introspection.getEntryNML("proposalStd ", self.proposalStd , "real" , ndim) ; end
157
158 end
159
160 end
161
162end
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
This is the base class for the ParaMonte sampler basic specifications.
Definition: SpecBase.m:26
This is the base class for the ParaMonte sampler MCMC specifications. This is an abstract class that...
Definition: SpecMCMC.m:19
Property proposalStartDomainCubeLimitUpper
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:54
function SpecMCMC(in method, in silent)
Construct and return an object of class pm.sampling.SpecMCMC.
Property outputSampleRefinementCount
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:30
Property proposalCov
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:42
Property proposalStartDomainCubeLimitLower
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:51
Property proposalStd
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:60
Property outputSampleRefinementMethod
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:33
Property outputChainSize
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:27
Property proposalCor
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:39
function getEntriesNML(in self, in ndim)
Ensure all specification properties of the parent object are sensible.
Property proposalStartRandomized
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:57
Property proposalStart
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:48
Property proposalScale
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:45
Property proposal
See the generic documentation at: https://www.cdslab.org/paramonte/generic/2/usage/sampling/paradram/...
Definition: SpecMCMC.m:36
function getEntryNML(in varname, in varval, in vartype, in varsize)
Return a Fortran-namelist-compatible conversion of the input varval.
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...