From 1ff6b2de7b158eec68d0e3e62c913e88f95bb30c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?=
 <stephane.adjemian@univ-lemans.fr>
Date: Wed, 2 Oct 2013 17:08:04 +0200
Subject: [PATCH] Fixed bug caused by the size of the vector of parameters
 (transposition needed).

---
 matlab/simpsa.m | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/matlab/simpsa.m b/matlab/simpsa.m
index be654568d..260607a24 100644
--- a/matlab/simpsa.m
+++ b/matlab/simpsa.m
@@ -235,7 +235,7 @@ while 1,
     
     % if output function given then run output function to plot intermediate result
     if ~isempty(OPTIONS.OUTPUT_FCN),
-        feval(OPTIONS.OUTPUT_FCN,P(1,:),Y(1));
+        feval(OPTIONS.OUTPUT_FCN,transpose(P(1,:)),Y(1));
     end
     
     % remaining vertices of simplex
@@ -321,7 +321,7 @@ while 1,
         
         % if output function given then run output function to plot intermediate result
         if ~isempty(OPTIONS.OUTPUT_FCN),
-            feval(OPTIONS.OUTPUT_FCN,P(1,:),Y(1));
+            feval(OPTIONS.OUTPUT_FCN,transpose(P(1,:)),Y(1));
         end
         
         % end the optimization if one of the stopping criteria is met
@@ -449,7 +449,7 @@ while 1,
 end
 
 % return solution
-X = PBEST;
+X = transpose(PBEST);
 FVAL = YBEST;
 
 % store number of function evaluations
@@ -516,7 +516,7 @@ for i = 1:NDIM,
 end
 
 % calculate cost associated with PTRY
-YTRY = feval(FUN,PTRY,varargin{:});
+YTRY = feval(FUN,PTRY(:),varargin{:});
 
 % add one to number of function evaluations
 nFUN_EVALS = nFUN_EVALS + 1;
-- 
GitLab