From 2b6ee881a456c7564b670cb0c4611c6ba00c39be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemia=20=28Scylla=29?= Date: Wed, 22 Aug 2018 11:49:15 +0200 Subject: [PATCH] Efficiency changes. --- matlab/+pac/+estimate/init.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/matlab/+pac/+estimate/init.m b/matlab/+pac/+estimate/init.m index 391d2b24e..6a6e7f38f 100644 --- a/matlab/+pac/+estimate/init.m +++ b/matlab/+pac/+estimate/init.m @@ -58,7 +58,7 @@ end % Get indices of estimated parameters. ipnames_ = zeros(size(pnames_)); for i=1:length(ipnames_) - ipnames_(i) = strmatch(pnames_{i}, M_.param_names, 'exact'); + ipnames_(i) = find(strcmp(pnames_{i}, M_.param_names)); end % Ensure that the error correction parameter comes first, followed by the @@ -76,7 +76,7 @@ for i=1:length(ipnames_) end % Remove calibrated parameters (if any). -ipnames_(find(isnan(ipnames_))) = []; +ipnames_(isnan(ipnames_)) = []; % Reorder params if needed. [~, permutation] = ismember(ipnames__, ipnames_); @@ -96,8 +96,7 @@ xnbr = length(xnames); % Test if we have a residual and get its name (-> rname). if isequal(xnbr, 1) - rname = M_.exo_names{strmatch(xnames{1}, M_.exo_names, 'exact')}; - irname = 1; + rname = M_.exo_names{strcmp(xnames{1}, M_.exo_names)}; if ~all(isnan(data{xnames{1}}.data)) error('The residual (%s) must have NaN values in the provided database.', xnames{1}) end