1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4%%%% ParaMonte: Parallel Monte Carlo and Machine Learning Library. %%%%
6%%%% Copyright (C) 2012-present, The Computational Data Science Lab %%%%
8%%%% This file is part of the ParaMonte library. %%%%
14%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
23format compact; format long;
25% set path to the ParaMonte MATLAB library
27pmlibRootDir =
'./'; % set
this path to the paramonte library
root dir
28addpath(genpath(pmlibRootDir));
30% change MATLAB
's working directory to the folder containing this script
32filePath = mfilename('fullpath
');
33[currentDir,fileName,fileExt] = fileparts(filePath); cd(currentDir); % Change working directory to source code directory.
34cd(fileparts(mfilename('fullpath
'))); % Change working directory to source code directory.
36% define the objective function
38NDIM = 2; % number of dimensions of the domain of the distribution
40% create a ParaMonte object
42pm = paramonte(); % use paramonte("matlab") to use the MATLAB kernel instead of interface
44% create a ParaDRAM simulation object
48pmpd.mpiEnabled = false;
49pmpd.bldtype = "release";
50pmpd.spec.randomSeed = 31731;
51pmpd.spec.outputFileName = "./RosenBrock/";
52pmpd.spec.sampleRefinementCount = 1;
53pmpd.spec.outputSeparator = ",";
54pmpd.spec.chainSize = 15000;
55pmpd.spec.sampleSize = -100;
56pmpd.spec.targetAcceptanceRate = [0.01,0.3];
57pmpd.spec.proposalStd = [2,2];
59getNegLogRosen = @(point) -log( 100.0 * (point(2)-point(1)^2)^2 + (point(1)-1.0)^2 );
61pmpd.runSampler ( NDIM ... number of dimensions of the objective function
62 , getNegLogRosen ... the objective function
65function logFunc = getLogFunc(point)
66 logFunc = -log( 100.0 * (point(2)-point(1)^2)^2 + (point(1)-1.0)^2 );
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.
function getLogFunc(in point)