From dfcb9df58da324ed4e4bdea435b8700793746085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Wed, 10 Jan 2018 10:35:17 +0100 Subject: [PATCH] Changed the type of the variable returned by list_of_parameters_calibrated_as_{Inf,NaN}. --- matlab/dynare_estimation_init.m | 16 ++++++++-------- matlab/list_of_parameters_calibrated_as_Inf.m | 11 +++++++---- matlab/list_of_parameters_calibrated_as_NaN.m | 12 ++++++++---- matlab/test_for_deep_parameters_calibration.m | 4 ++-- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/matlab/dynare_estimation_init.m b/matlab/dynare_estimation_init.m index c95e455b3..fb4575209 100644 --- a/matlab/dynare_estimation_init.m +++ b/matlab/dynare_estimation_init.m @@ -574,11 +574,11 @@ if info(1) plist = list_of_parameters_calibrated_as_NaN(M); if ~isempty(plist) message = ['dynare_estimation_init:: Some of the parameters are NaN (' ]; - for i=1:size(plist,1) - if i. + idx = find(isinf(M_.params)); nnn = length(idx); -list = []; + if nnn - list = M_.param_names(idx,:); + list = M_.param_names(idx); +else + list = {}; end \ No newline at end of file diff --git a/matlab/list_of_parameters_calibrated_as_NaN.m b/matlab/list_of_parameters_calibrated_as_NaN.m index 01964a89a..9c39b4cbe 100644 --- a/matlab/list_of_parameters_calibrated_as_NaN.m +++ b/matlab/list_of_parameters_calibrated_as_NaN.m @@ -1,11 +1,12 @@ function list = list_of_parameters_calibrated_as_NaN(M_) + % The name of the function is explicit enough... % % INPUTS % M_ [structure] Description of the (simulated or estimated) model. % % OUTPUTS -% list [char] n*p array of characters, each line is the name of parameter without value. +% list [cell] Each element is the name (row char array) of parameter without value. % % ALGORITHM % none @@ -13,7 +14,7 @@ function list = list_of_parameters_calibrated_as_NaN(M_) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2010-2017 Dynare Team +% Copyright (C) 2010-2018 Dynare Team % % This file is part of Dynare. % @@ -29,9 +30,12 @@ function list = list_of_parameters_calibrated_as_NaN(M_) % % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . + idx = find(isnan(M_.params)); nnn = length(idx); -list = []; + if nnn - list = M_.param_names(idx,:); + list = M_.param_names(idx); +else + list = {}; end \ No newline at end of file diff --git a/matlab/test_for_deep_parameters_calibration.m b/matlab/test_for_deep_parameters_calibration.m index 7949646ce..722ad65fc 100644 --- a/matlab/test_for_deep_parameters_calibration.m +++ b/matlab/test_for_deep_parameters_calibration.m @@ -33,8 +33,8 @@ plist = list_of_parameters_calibrated_as_NaN(M_); if ~isempty(plist) info=1; message = ['Some of the parameters have no value (' ]; - for i=1:size(plist,1) - if i