From feb71b773132e204ed6bd889bd9a26666a3bed70 Mon Sep 17 00:00:00 2001
From: Michel Juillard <michel.juillard@mjui.fr>
Date: Sun, 24 Jul 2011 23:01:50 +0200
Subject: [PATCH] fixing problem with bayestopt_.p5 (prior mode) (cherry picked
 from commit 89e66dfd9882726c355e2e562b19488215657e01)

---
 matlab/set_prior.m | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/matlab/set_prior.m b/matlab/set_prior.m
index 66633792c..b5b720b57 100644
--- a/matlab/set_prior.m
+++ b/matlab/set_prior.m
@@ -55,7 +55,7 @@ bayestopt_.p1 = []; % prior mean
 bayestopt_.p2 = []; % prior standard deviation
 bayestopt_.p3 = []; % lower bound
 bayestopt_.p4 = []; % upper bound
-bayestopt_.p5 = []; % prior mode
+bayestopt_.p5 = zeros(nvx+nvn+ncx+ncn+np,1); % prior mode
 bayestopt_.p6 = []; % first hyper-parameter (\alpha for the BETA and GAMMA distributions, s for the INVERSE GAMMAs, expectation for the GAUSSIAN distribution, lower bound for the UNIFORM distribution).
 bayestopt_.p7 = []; % second hyper-parameter (\beta for the BETA and GAMMA distributions, \nu for the INVERSE GAMMAs, standard deviation for the GAUSSIAN distribution, upper bound for the UNIFORM distribution).
 
@@ -261,23 +261,17 @@ if exist([ M_.dname '/prior/definition.mat'])
     if length(bayestopt_.p1)==length(old.bayestopt_.p1)
         if any(bayestopt_.p1-old.bayestopt_.p1)
             prior_has_changed = 1;
-        end
-        if any(bayestopt_.p2-old.bayestopt_.p2)
+        elseif any(bayestopt_.p2-old.bayestopt_.p2)
             prior_has_changed = 1;
-        end
-        if any(bayestopt_.p3-old.bayestopt_.p3)
+        elseif any(bayestopt_.p3-old.bayestopt_.p3)
             prior_has_changed = 1;
-        end
-        if any(bayestopt_.p4-old.bayestopt_.p4)
+        elseif any(bayestopt_.p4-old.bayestopt_.p4)
             prior_has_changed = 1;
-        end
-        if any(bayestopt_.p5-old.bayestopt_.p5)
+        elseif any(bayestopt_.p5-old.bayestopt_.p5(:))
             prior_has_changed = 1;
-        end
-        if any(bayestopt_.p6-old.bayestopt_.p6)
+        elseif any(bayestopt_.p6-old.bayestopt_.p6)
             prior_has_changed = 1;
-        end
-        if any(bayestopt_.p7-old.bayestopt_.p7)
+        elseif any(bayestopt_.p7-old.bayestopt_.p7)
             prior_has_changed = 1;
         end
     else
-- 
GitLab