From 5424fde74ede37708a55ca96ef9c8403a371cc29 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Fri, 3 Mar 2017 17:03:59 +0100
Subject: [PATCH] metropolis_draw.m: Replace round by ceil to avoid crashes
 when 0 draws would be used

(cherry picked from commit 2dc3ad22fdb8fedee7fdd2ed3577978bd8f37324)
---
 matlab/metropolis_draw.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/metropolis_draw.m b/matlab/metropolis_draw.m
index 722feba956..ad396b30b7 100644
--- a/matlab/metropolis_draw.m
+++ b/matlab/metropolis_draw.m
@@ -70,7 +70,7 @@ if init
     mh_nblck = options_.mh_nblck;
     % set sub_draws option if empty
     if isempty(options_.sub_draws)
-        options_.sub_draws = min(options_.posterior_max_subsample_draws, round(NumberOfDraws*mh_nblck));
+        options_.sub_draws = min(options_.posterior_max_subsample_draws, ceil(.25*NumberOfDraws));
     else
         if options_.sub_draws>NumberOfDraws*mh_nblck
             skipline()
-- 
GitLab