diff --git a/matlab/dsge_likelihood.m b/matlab/dsge_likelihood.m index 62d5ff570..8ff23126c 100644 --- a/matlab/dsge_likelihood.m +++ b/matlab/dsge_likelihood.m @@ -115,7 +115,7 @@ function [fval,info,exit_flag,DLIK,Hess,SteadyState,trend_coeff,Model,DynareOpti %! @end deftypefn %@eod: -% Copyright (C) 2004-2020 Dynare Team +% Copyright (C) 2004-2021 Dynare Team % % This file is part of Dynare. % @@ -148,7 +148,12 @@ end Hess = []; % Ensure that xparam1 is a column vector. -xparam1 = xparam1(:); +% (Don't do the transformation if xparam1 is empty, otherwise it would become a +% 0×1 matrix, which create issues with older MATLABs when comparing with [] in +% check_bounds_and_definiteness_estimation) +if ~isempty(xparam1) + xparam1 = xparam1(:); +end if DynareOptions.estimation_dll [fval,exit_flag,SteadyState,trend_coeff,info,params,H,Q] ... diff --git a/matlab/dsge_var_likelihood.m b/matlab/dsge_var_likelihood.m index 596136ce8..c1b490819 100644 --- a/matlab/dsge_var_likelihood.m +++ b/matlab/dsge_var_likelihood.m @@ -37,7 +37,7 @@ function [fval,info,exit_flag,grad,hess,SteadyState,trend_coeff,PHI_tilde,SIGMA_ % SPECIAL REQUIREMENTS % None. -% Copyright (C) 2006-2018 Dynare Team +% Copyright (C) 2006-2021 Dynare Team % % This file is part of Dynare. % @@ -69,7 +69,12 @@ prior = []; trend_coeff=[]; % Ensure that xparam1 is a column vector. -xparam1 = xparam1(:); +% (Don't do the transformation if xparam1 is empty, otherwise it would become a +% 0×1 matrix, which create issues with older MATLABs when comparing with [] in +% check_bounds_and_definiteness_estimation) +if ~isempty(xparam1) + xparam1 = xparam1(:); +end % Initialization of of the index for parameter dsge_prior_weight in Model.params. if isempty(dsge_prior_weight_idx) @@ -317,4 +322,4 @@ if (nargout==11) prior.ArtificialSampleSize = fix(dsge_prior_weight*NumberOfObservations); prior.DF = prior.ArtificialSampleSize - NumberOfParameters - NumberOfObservedVariables; prior.iGXX_star = iGXX; -end \ No newline at end of file +end diff --git a/matlab/non_linear_dsge_likelihood.m b/matlab/non_linear_dsge_likelihood.m index b5a9ff76f..7f34ab2d3 100644 --- a/matlab/non_linear_dsge_likelihood.m +++ b/matlab/non_linear_dsge_likelihood.m @@ -26,7 +26,7 @@ function [fval,info,exit_flag,DLIK,Hess,ys,trend_coeff,Model,DynareOptions,Bayes % - BayesInfo [struct] See INPUTS section. % - DynareResults [struct] Updated DynareResults structure described in INPUTS section. -% Copyright (C) 2010-2019 Dynare Team +% Copyright (C) 2010-2021 Dynare Team % % This file is part of Dynare. % @@ -52,7 +52,12 @@ DLIK = []; Hess = []; % Ensure that xparam1 is a column vector. -xparam1 = xparam1(:); +% (Don't do the transformation if xparam1 is empty, otherwise it would become a +% 0×1 matrix, which create issues with older MATLABs when comparing with [] in +% check_bounds_and_definiteness_estimation) +if ~isempty(xparam1) + xparam1 = xparam1(:); +end % Issue an error if loglinear option is used. if DynareOptions.loglinear