From 2acacf61f1a03bb82554bec75f6df46735c9e14a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= <sebastien@dynare.org>
Date: Mon, 6 Jul 2020 18:42:05 +0200
Subject: [PATCH] Matrix notation: fix bug in numerical Hessian of external
 functions

---
 matlab/hess_element.m | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/matlab/hess_element.m b/matlab/hess_element.m
index 069a0ea9ec..2c86e78c76 100644
--- a/matlab/hess_element.m
+++ b/matlab/hess_element.m
@@ -59,7 +59,7 @@ m11{arg2}(elem2) = m11{arg2}(elem2) - h;
 
 % From Abramowitz and Stegun. Handbook of Mathematical Functions (1965)
 % formulas 25.3.24 and 25.3.27 p. 884
-if arg1==arg2
+if arg1 == arg2 && elem1 == elem2
     d = (16*func(p10{:})...
          +16*func(m10{:})...
          -30*func(args{:})...
-- 
GitLab