Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dynare
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
121
Issues
121
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dynare
dynare
Commits
b186eb7e
Commit
b186eb7e
authored
Dec 17, 2010
by
Marco Ratto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes for console mode in serial and parallel execution
parent
191de783
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
14 deletions
+23
-14
matlab/random_walk_metropolis_hastings_core.m
matlab/random_walk_metropolis_hastings_core.m
+23
-14
No files found.
matlab/random_walk_metropolis_hastings_core.m
View file @
b186eb7e
...
...
@@ -149,20 +149,27 @@ for b = fblck:nblck,
if
exist
(
'OCTAVE_VERSION'
)
||
options_
.
console_mode
diary
off
disp
(
' '
)
elseif
whoiam
% keyboard;
waitbarString
=
[
'Please wait... Metropolis-Hastings ('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
')...'
];
% waitbarTitle=['Metropolis-Hastings ',options_.parallel(ThisMatlab).ComputerName];
newString
=
''
;
if
whoiam
waitbarString
=
[
'Wait... MH ('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
')...'
];
end
else
,
if
whoiam
waitbarString
=
[
'Please wait... Metropolis-Hastings ('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
')...'
];
else
hh
=
waitbar
(
0
,[
'Please wait... Metropolis-Hastings ('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
')...'
]);
set
(
hh
,
'Name'
,
'Metropolis-Hastings'
);
end
end
if
whoiam
if
options_
.
parallel
(
ThisMatlab
)
.
Local
,
waitbarTitle
=
[
'Local '
];
else
waitbarTitle
=
[
options_
.
parallel
(
ThisMatlab
)
.
ComputerName
];
end
fMessageStatus
(
0
,
whoiam
,
waitbarString
,
waitbarTitle
,
options_
.
parallel
(
ThisMatlab
));
else
,
hh
=
waitbar
(
0
,[
'Please wait... Metropolis-Hastings ('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
')...'
]);
set
(
hh
,
'Name'
,
'Metropolis-Hastings'
);
prc0
=
(
b
-
fblck
)/(
nblck
-
fblck
+
1
)
*
(
exist
(
'OCTAVE_VERSION'
)
||
options_
.
console_mode
);
fMessageStatus
(
prc0
,
whoiam
,
waitbarString
,
waitbarTitle
,
options_
.
parallel
(
ThisMatlab
));
end
isux
=
0
;
jsux
=
0
;
...
...
@@ -196,13 +203,15 @@ for b = fblck:nblck,
if
exist
(
'OCTAVE_VERSION'
)
printf
(
'MH: Computing Metropolis-Hastings (chain %d/%d): %3.f%% done, acception rate: %3.f%%\r'
,
b
,
nblck
,
100
*
prtfrc
,
100
*
isux
/
j
);
else
fprintf
(
' MH: Computing Metropolis-Hastings (chain %d/%d): %3.f \b%% done, acceptance rate: %3.f \b%%\r'
,
b
,
nblck
,
100
*
prtfrc
,
100
*
isux
/
j
);
s0
=
repmat
(
'\b'
,
1
,
length
(
newString
));
newString
=
sprintf
(
'MH: Computing Metropolis-Hastings (chain %d/%d): %3.f%% done, acceptance rate: %3.f%%'
,
b
,
nblck
,
100
*
prtfrc
,
100
*
isux
/
j
);
fprintf
([
s0
,
'%s'
],
newString
);
end
end
if
mod
(
j
,
50
)
==
0
&
whoiam
% keyboard;
waitbarString
=
[
'('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
'), '
sprintf
(
'accept. %3.f%%
%%
'
,
100
*
isux
/
j
)];
fMessageStatus
(
prtfrc
,
whoiam
,
waitbarString
,
''
,
options_
.
parallel
(
ThisMatlab
));
waitbarString
=
[
'('
int2str
(
b
)
'/'
int2str
(
options_
.
mh_nblck
)
'), '
sprintf
(
'accept. %3.f%%'
,
100
*
isux
/
j
)];
fMessageStatus
(
(
b
-
fblck
)/(
nblck
-
fblck
+
1
)
+
prtfrc
/(
nblck
-
fblck
+
1
)
,
whoiam
,
waitbarString
,
''
,
options_
.
parallel
(
ThisMatlab
));
end
else
if
mod
(
j
,
3
)
==
0
&
~
whoiam
...
...
@@ -258,14 +267,14 @@ for b = fblck:nblck,
irun
=
irun
+
1
;
end
% End of the simulations for one mh-block.
record
.
AcceptationRates
(
b
)
=
isux
/
j
;
if
exist
(
'OCTAVE_VERSION'
)
||
options_
.
console_mode
if
exist
(
'OCTAVE_VERSION'
)
||
options_
.
console_mode
||
whoiam
if
exist
(
'OCTAVE_VERSION'
)
printf
(
'\n'
);
else
fprintf
(
'\n'
);
end
diary
on
;
elseif
~
whoiam
else
%
if ~whoiam
close
(
hh
);
end
record
.
Seeds
(
b
)
.
Normal
=
randn
(
'state'
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment