From 4a6783c6900b5f83276af9819c6262af3ad52107 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Guts=29?= <stepan@adjemian.eu>
Date: Fri, 15 Dec 2023 12:43:56 +0100
Subject: [PATCH] Fix #1914.

Also the first input argument of was wrong (we do not pass bayestopt_
anymore but only the list of estimated parameter names, field `name`).
---
 matlab/estimation/check_posterior_sampler_options.m | 4 +---
 matlab/estimation/marginal_density.m                | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/matlab/estimation/check_posterior_sampler_options.m b/matlab/estimation/check_posterior_sampler_options.m
index 3c81972df9..e7fab78d69 100644
--- a/matlab/estimation/check_posterior_sampler_options.m
+++ b/matlab/estimation/check_posterior_sampler_options.m
@@ -464,12 +464,10 @@ if ~strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
 end
 
 if options_.load_mh_file && posterior_sampler_options.use_mh_covariance_matrix
-    [~, invhess] = compute_mh_covariance_matrix(bayestopt_,fname,dname,outputFolderName);
+    [~, invhess] = compute_posterior_covariance_matrix(bayestopt_.name, fname, dname, outputFolderName);
     posterior_sampler_options.invhess = invhess;
 end
 
-
-
 % check specific options for slice sampler
 if strcmp(posterior_sampler_options.posterior_sampling_method,'slice')
     invhess = posterior_sampler_options.invhess;
diff --git a/matlab/estimation/marginal_density.m b/matlab/estimation/marginal_density.m
index 323857e8b6..26e45e5260 100644
--- a/matlab/estimation/marginal_density.m
+++ b/matlab/estimation/marginal_density.m
@@ -51,7 +51,7 @@ TotalNumberOfMhDraws = sum(record.MhDraws(:,1));
 TODROP = floor(options_.mh_drop*TotalNumberOfMhDraws);
 
 fprintf('marginal density: I''m computing the posterior mean and covariance... ');
-[posterior_mean,posterior_covariance,posterior_mode,posterior_kernel_at_the_mode] = compute_mh_covariance_matrix(bayestopt_,M_.fname,M_.dname,outputFolderName);
+[posterior_mean, posterior_covariance, posterior_mode, posterior_kernel_at_the_mode] = compute_posterior_covariance_matrix(bayestopt_.name, M_.fname, M_.dname, outputFolderName);
 
 MU = transpose(posterior_mean);
 SIGMA = posterior_covariance;
-- 
GitLab