From 52a57eaf60618915d0c777100ad8a6bf60a0877e Mon Sep 17 00:00:00 2001
From: Willi Mutschler <willi@mutschler.eu>
Date: Thu, 14 Jan 2021 14:17:55 +0100
Subject: [PATCH] MoM: Remove duplicate check in gradient helper function

---
 ..._of_moments_objective_function_gradient_helper.m | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/matlab/method_of_moments/method_of_moments_objective_function_gradient_helper.m b/matlab/method_of_moments/method_of_moments_objective_function_gradient_helper.m
index cc30f2665f..f1c88af499 100644
--- a/matlab/method_of_moments/method_of_moments_objective_function_gradient_helper.m
+++ b/matlab/method_of_moments/method_of_moments_objective_function_gradient_helper.m
@@ -47,16 +47,9 @@ function [out1, out2] = method_of_moments_objective_function_gradient_helper(xpa
 % =========================================================================
 [fval, info, exit_flag, junk1, junk2, oo_, M_, options_mom_, df] = method_of_moments_objective_function(xparam1, Bounds, oo_, estim_params_, M_, options_mom_);
 
-switch options_mom_.current_optimizer
-    case 1 %fmincon
-        out1=fval; out2=df;
-    case 3 %fminunc
-        out1=fval; out2=df;
-    case 13 %lsqnonlin
-        out1=fval; out2=df;
-    otherwise
-        error('Method of Moments: analytic_jacobian option is currently only supported by mode_compute 1, 3 and 13');
-end
+% mode_compute=1|3|13 require the gradient as second output argument
+out1=fval;
+out2=df;
 
 end%main function end
 
-- 
GitLab