From d049c0b974d4e1732f7d8736805aaf0ba4ad9734 Mon Sep 17 00:00:00 2001
From: Johannes Pfeifer <jpfeifer@gmx.de>
Date: Thu, 6 Feb 2025 16:07:43 +0100
Subject: [PATCH] DSMH: filter out case where number of particles is too small

---
 matlab/estimation/check_posterior_sampler_options.m | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/matlab/estimation/check_posterior_sampler_options.m b/matlab/estimation/check_posterior_sampler_options.m
index ed9e08da28..c1337ddf28 100644
--- a/matlab/estimation/check_posterior_sampler_options.m
+++ b/matlab/estimation/check_posterior_sampler_options.m
@@ -506,6 +506,9 @@ if init
               end
           end
 
+          if posterior_sampler_options.particles<posterior_sampler_options.N*posterior_sampler_options.G
+              error('check_posterior_sampler_options:: DSMH requires particles to be at least than N*G = %u ',posterior_sampler_options.N*posterior_sampler_options.G);             
+          end
           options_.mode_compute = 0;
           options_.cova_compute = 0;
           options_.mh_replic = 0;
-- 
GitLab