Commit 30265755 authored by adjemian's avatar adjemian
Browse files

v4.1: Bug correction related to the mh_recover mode (needs more tests).

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@2264 ac1d8469-bf42-47a9-8791-bf33cf982152
parent ca0e8862
......@@ -310,7 +310,7 @@ elseif options_.mh_recover
while b <= nblck
if NumberOfMhFilesPerBlock(b) < ExpectedNumberOfMhFilesPerBlock
CrashedBlck = b;% YES, chain b!
disp(['MH: Chain ' int2str(b) ' is uncomplete!'])
disp(['MH: Chain ' int2str(b) ' is not complete!'])
break
else
disp(['MH: Chain ' int2str(b) ' is complete!'])
......@@ -324,7 +324,7 @@ elseif options_.mh_recover
end
%% The new metropolis-hastings should start from chain... (fblck=CrashedBlck)
fblck = CrashedBlck;
%% How many mh-files are saved in this block ?
%% How many mh-files are saved in this block?
NumberOfSavedMhFilesInTheCrashedBlck = NumberOfMhFilesPerBlock(CrashedBlck);
%% How many mh-files were saved in this block during the last session
%% (if there was a complete session before the crash)
......@@ -353,10 +353,6 @@ elseif options_.mh_recover
IsTheLastFileOfThePreviousMhFull = 0;
NumberOfCompletedMhFiles = NumberOfMhFilesPerBlock(CrashedBlck);
reste = 0;
elseif ~OldMh && NumberOfSavedMhFilesInTheCrashedBlck
IsTheLastFileOfThePreviousMhFull = 0;
NumberOfCompletedMhFiles = 0;
reste = 0;
end
%% How many runs were saved ?
NumberOfSavedDraws = MAX_nruns*NumberOfCompletedMhFiles + reste;
......@@ -383,6 +379,18 @@ elseif options_.mh_recover
end
end
ilogpo2(CrashedBlck) = logpo2(end);
ix2(CrashedBlck,:) = x2(end,:);
ix2(CrashedBlck,:) = x2(end,:);
else
if NumberOfSavedMhFilesInTheCrashedBlck
load([MhDirectoryName '/' ModelName '_mh' ...
int2str(NumberOfCompletedMhFiles) '_blck' int2str(CrashedBlck) '.mat']);
fline(CrashedBlck,1) = 1;
NewFile(CrashedBlck) = NumberOfCompletedMhFiles+1;% NumberOfSavedMhFilesInTheCrashedBlck+1;
ilogpo2(CrashedBlck) = logpo2(end);
ix2(CrashedBlck,:) = x2(end,:);
else
fline(CrashedBlck,1) = 1;
NewFile(CrashedBlck) = 1;
end
end
end% of (if options_.load_mh_file == {0,1 or -1})
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment