Correction of a bug with mh_recover.

git-svn-id: https://www.dynare.org/svn/dynare/dynare_v4@1344 ac1d8469-bf42-47a9-8791-bf33cf982152
time-shift
adjemian 2007-07-06 14:50:09 +00:00
parent 6d6174d6ae
commit 01e7407d76
1 changed files with 3 additions and 2 deletions

View File

@ -174,6 +174,7 @@ if ~options_.load_mh_file & ~options_.mh_recover
fprintf(fidlog,[' ' num2str(record.Seeds.Unifor(i)') '\n']); fprintf(fidlog,[' ' num2str(record.Seeds.Unifor(i)') '\n']);
end end
fprintf(fidlog,' \n'); fprintf(fidlog,' \n');
fclose(fidlog);
elseif options_.load_mh_file & ~options_.mh_recover elseif options_.load_mh_file & ~options_.mh_recover
%% Here we consider previous mh files (previous mh did not crash). %% Here we consider previous mh files (previous mh did not crash).
disp('MH: I''m loading past metropolis-hastings simulations...') disp('MH: I''m loading past metropolis-hastings simulations...')
@ -234,6 +235,7 @@ elseif options_.load_mh_file & ~options_.mh_recover
save([MhDirectoryName '/' ModelName '_mh_history'],'record'); save([MhDirectoryName '/' ModelName '_mh_history'],'record');
disp(['MH: ... It''s done. I''ve loaded ' int2str(NumberOfPreviousSimulations) ' simulations.']) disp(['MH: ... It''s done. I''ve loaded ' int2str(NumberOfPreviousSimulations) ' simulations.'])
disp(' ') disp(' ')
fclose(fidlog);
elseif options_.mh_recover elseif options_.mh_recover
%% The previous metropolis-hastings crashed before the end! I try to %% The previous metropolis-hastings crashed before the end! I try to
%% recover the saved draws... %% recover the saved draws...
@ -345,7 +347,7 @@ elseif options_.mh_recover
elseif ~OldMh && NumberOfSavedMhFilesInTheCrashedBlck elseif ~OldMh && NumberOfSavedMhFilesInTheCrashedBlck
IsTheLastFileOfThePreviousMhFull = 0; IsTheLastFileOfThePreviousMhFull = 0;
NumberOfCompletedMhFiles = 0; NumberOfCompletedMhFiles = 0;
reste = 0; reste = 0;
end end
%% How many runs were saved ? %% How many runs were saved ?
NumberOfSavedDraws = MAX_nruns*NumberOfCompletedMhFiles + reste; NumberOfSavedDraws = MAX_nruns*NumberOfCompletedMhFiles + reste;
@ -375,7 +377,6 @@ elseif options_.mh_recover
ix2(CrashedBlck,:) = x2(end,:); ix2(CrashedBlck,:) = x2(end,:);
end end
end% of (if options_.load_mh_file == {0,1 or -1}) end% of (if options_.load_mh_file == {0,1 or -1})
fclose(fidlog);
%%%% %%%%
%%%% NOW i run the (nblck-fblck+1) metropolis-hastings chains %%%% NOW i run the (nblck-fblck+1) metropolis-hastings chains
%%%% %%%%