From 47477e152a3575b0108f5845ba76ec2ca3c54330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Fri, 12 Mar 2021 14:50:35 +0100 Subject: [PATCH] Bump minimal Octave version to 6.2.0 --- license.txt | 2 +- matlab/+pac/+estimate/iterative_ols.m | 4 - matlab/aggregate.m | 18 +--- matlab/compute_moments_varendo.m | 8 +- matlab/conditional_variance_decomposition.m | 8 +- ...al_variance_decomposition_ME_mc_analysis.m | 6 +- matlab/disp_moments.m | 8 +- matlab/disp_th_moments.m | 16 +--- ...tical_conditional_variance_decomposition.m | 8 +- ...lated_theoretical_variance_decomposition.m | 8 +- matlab/dynare.m | 4 +- matlab/dynare_config.m | 15 +-- matlab/lmmcp/catstruct.m | 8 +- .../intersect_stable/intersect_stable.m | 91 ------------------- matlab/missing/ordeig/ordeig.m | 46 ---------- matlab/missing/unique_stable/unique_stable.m | 44 --------- matlab/modules/dseries | 2 +- matlab/ols/getEquationsByTags.m | 6 +- matlab/posterior_analysis.m | 8 +- mex/build/octave/configure.ac | 2 +- tests/bgp/fs2000/fs2000.mod | 11 +-- tests/bgp/nk-1/nk.mod | 9 +- tests/bgp/ramsey-1/ramsey.mod | 9 +- tests/bgp/solow-1/solow.mod | 9 +- .../example1.mod | 12 +-- .../stochastic_purely_forward.mod | 7 -- .../stochastic_purely_forward_with_static.mod | 7 -- 27 files changed, 37 insertions(+), 339 deletions(-) delete mode 100644 matlab/missing/intersect_stable/intersect_stable.m delete mode 100644 matlab/missing/ordeig/ordeig.m delete mode 100644 matlab/missing/unique_stable/unique_stable.m diff --git a/license.txt b/license.txt index 9a514fc23..43f6280eb 100644 --- a/license.txt +++ b/license.txt @@ -210,7 +210,7 @@ License: GPL-3+ Files: matlab/lmmcp/catstruct.m Copyright: 2005 Jos van der Geest 2013 Christophe Gouel - 2016-2017 Dynare Team + 2016-2021 Dynare Team License: BSD-2-clause Files: matlab/lmmcp/lmmcp.m diff --git a/matlab/+pac/+estimate/iterative_ols.m b/matlab/+pac/+estimate/iterative_ols.m index aba2345fe..1de639bb3 100644 --- a/matlab/+pac/+estimate/iterative_ols.m +++ b/matlab/+pac/+estimate/iterative_ols.m @@ -303,10 +303,6 @@ end % Get indices in params0 for other parameters (optimizing agents share plus parameters related to exogenous variables). [~, params_id_2] = setdiff(1:length(ipnames_), params_id_1); -if isoctave && octave_ver_less_than('6') - % Under Octave < 6, setdiff() behaves as with the 'legacy' option (i.e. pre-R2012b behaviour) - params_id_2 = params_id_2'; -end % Get indices in params0 for the parameters associated to the exogenous variables. params_id_3 = setdiff(params_id_2, params_id_0); diff --git a/matlab/aggregate.m b/matlab/aggregate.m index e0d20b4cc..f8b32915a 100644 --- a/matlab/aggregate.m +++ b/matlab/aggregate.m @@ -111,11 +111,7 @@ for i=1:length(varargin) end end eqlist = eqlist(1:eqnum,:); -if isoctave && octave_ver_less_than('6') - [~, idx] = unique_stable(eqlist(:,1)); -else - [~, idx] = unique(eqlist(:,1), 'stable'); -end +[~, idx] = unique(eqlist(:,1), 'stable'); eqlist = eqlist(idx, :); % Get endogenous variables. @@ -138,11 +134,7 @@ for i=1:length(varargin) fclose(fid); end elist = elist(1:enum,:); -if isoctave && octave_ver_less_than('6') - [~, idx] = unique_stable(elist(:,1)); -else - [~, idx] = unique(elist(:,1), 'stable'); -end +[~, idx] = unique(elist(:,1), 'stable'); elist = elist(idx,:); % Get exogenous variables. @@ -170,11 +162,7 @@ for i=1:length(varargin) fclose(fid); end xlist = xlist(1:xnum,:); -if isoctave && octave_ver_less_than('6') - [~, idx] = unique_stable(xlist(:,1)); -else - [~, idx] = unique(xlist(:,1), 'stable'); -end +[~, idx] = unique(xlist(:,1), 'stable'); xlist = xlist(idx,:); % Get parameter values. diff --git a/matlab/compute_moments_varendo.m b/matlab/compute_moments_varendo.m index 936806cc8..80ec3d79d 100644 --- a/matlab/compute_moments_varendo.m +++ b/matlab/compute_moments_varendo.m @@ -17,7 +17,7 @@ function oo_ = compute_moments_varendo(type, options_, M_, oo_, var_list_) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2008-2020 Dynare Team +% Copyright (C) 2008-2021 Dynare Team % % This file is part of Dynare. % @@ -168,11 +168,7 @@ if options_.order==1 end skipline(); if ~all(diag(M_.H)==0) - if isoctave && octave_ver_less_than('6') - [observable_name_requested_vars, varlist_pos] = intersect_stable(var_list_, options_.varobs); - else - [observable_name_requested_vars, varlist_pos] = intersect(var_list_, options_.varobs, 'stable'); - end + [observable_name_requested_vars, varlist_pos] = intersect(var_list_, options_.varobs, 'stable'); if ~isempty(observable_name_requested_vars) NumberOfObservedEndogenousVariables = length(observable_name_requested_vars); temp = NaN(NumberOfObservedEndogenousVariables, NumberOfExogenousVariables+1); diff --git a/matlab/conditional_variance_decomposition.m b/matlab/conditional_variance_decomposition.m index 8a8b90834..83020a736 100644 --- a/matlab/conditional_variance_decomposition.m +++ b/matlab/conditional_variance_decomposition.m @@ -17,7 +17,7 @@ function [ConditionalVarianceDecomposition, ConditionalVarianceDecomposition_ME] % h is the number of Steps % p is the number of state innovations and -% Copyright (C) 2010-2020 Dynare Team +% Copyright (C) 2010-2021 Dynare Team % % This file is part of Dynare. % @@ -89,11 +89,7 @@ end % Measurement error if ~all(diag(StateSpaceModel.measurement_error)==0) - if isoctave && octave_ver_less_than('6') - [observable_pos,index_subset,index_observables]=intersect_stable(SubsetOfVariables,StateSpaceModel.observable_pos); - else - [observable_pos,index_subset,index_observables]=intersect(SubsetOfVariables,StateSpaceModel.observable_pos,'stable'); - end + [observable_pos,index_subset,index_observables]=intersect(SubsetOfVariables,StateSpaceModel.observable_pos,'stable'); ME_Variance=diag(StateSpaceModel.measurement_error); ConditionalVarianceDecomposition_ME = zeros(length(observable_pos),length(Steps),number_of_state_innovations+1); diff --git a/matlab/conditional_variance_decomposition_ME_mc_analysis.m b/matlab/conditional_variance_decomposition_ME_mc_analysis.m index b9f187298..f0e835011 100644 --- a/matlab/conditional_variance_decomposition_ME_mc_analysis.m +++ b/matlab/conditional_variance_decomposition_ME_mc_analysis.m @@ -63,11 +63,7 @@ if isempty(exogenous_variable_index) end end -if isoctave && octave_ver_less_than('6') - [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(var_list,options_.varobs); -else - [observable_pos_requested_vars,index_subset,index_observables]=intersect(var_list,options_.varobs,'stable'); -end +[observable_pos_requested_vars,index_subset,index_observables]=intersect(var_list,options_.varobs,'stable'); matrix_pos=strmatch(endo, var_list(index_subset),'exact'); name_1 = endo; name_2 = exo; diff --git a/matlab/disp_moments.m b/matlab/disp_moments.m index 94a6709ca..f3a86a57b 100644 --- a/matlab/disp_moments.m +++ b/matlab/disp_moments.m @@ -11,7 +11,7 @@ function oo_=disp_moments(y,var_list,M_,options_,oo_) % OUTPUTS % oo_ [structure] Dynare's results structure, -% Copyright (C) 2001-2020 Dynare Team +% Copyright (C) 2001-2021 Dynare Team % % This file is part of Dynare. % @@ -50,11 +50,7 @@ y = y(ivar,options_.drop+1:end)'; ME_present=0; if ~all(M_.H==0) - if isoctave && octave_ver_less_than('6') - [observable_pos_requested_vars, index_subset, index_observables] = intersect_stable(ivar, options_.varobs_id); - else - [observable_pos_requested_vars, index_subset, index_observables] = intersect(ivar, options_.varobs_id, 'stable'); - end + [observable_pos_requested_vars, index_subset, index_observables] = intersect(ivar, options_.varobs_id, 'stable'); if ~isempty(observable_pos_requested_vars) ME_present=1; i_ME = setdiff([1:size(M_.H,1)],find(diag(M_.H) == 0)); % find ME with 0 variance diff --git a/matlab/disp_th_moments.m b/matlab/disp_th_moments.m index 3c8466c51..87d51522d 100644 --- a/matlab/disp_th_moments.m +++ b/matlab/disp_th_moments.m @@ -2,7 +2,7 @@ function oo_ = disp_th_moments(dr, var_list, M_, options_, oo_) % Display theoretical moments of variables -% Copyright (C) 2001-2020 Dynare Team +% Copyright (C) 2001-2021 Dynare Team % % This file is part of Dynare. % @@ -55,11 +55,7 @@ oo_.var = oo_.gamma_y{1}; ME_present=0; if ~all(diag(M_.H)==0) - if isoctave && octave_ver_less_than('6') - [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id); - else - [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable'); - end + [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable'); if ~isempty(observable_pos_requested_vars) ME_present=1; end @@ -106,11 +102,7 @@ if size(stationary_vars, 1) > 0 lh = cellofchararraymaxlength(labels)+2; dyntable(options_, title, headers, labels, 100*oo_.gamma_y{options_.ar+2}(stationary_vars,:), lh, 8, 2); if ME_present - if isoctave && octave_ver_less_than('6') - [stationary_observables, pos_index_subset] = intersect_stable(index_subset, stationary_vars); - else - [stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable'); - end + [stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable'); headers_ME = vertcat(headers, 'ME'); labels=get_labels_transformed_vars(M_.endo_names,ivar(stationary_observables),options_,false); dyntable(options_, [title,' WITH MEASUREMENT ERROR'], headers_ME, labels, ... @@ -213,4 +205,4 @@ if options_.ar > 0 && size(stationary_vars, 1) > 0 dyn_latex_table(M_, options_, title, 'th_autocorr_matrix', headers, labels, z, lh, 8, 4); end end -end \ No newline at end of file +end diff --git a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m index a4722c832..23cdfdff1 100644 --- a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m +++ b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m @@ -19,7 +19,7 @@ function [nvar,vartan,NumberOfConditionalDecompFiles] = ... % vartan [char] array of characters (with nvar rows). % NumberOfConditionalDecompFiles [integer] scalar, number of prior or posterior data files (for covariance). -% Copyright (C) 2009-2020 Dynare Team +% Copyright (C) 2009-2021 Dynare Team % % This file is part of Dynare. % @@ -84,11 +84,7 @@ MaXNumberOfConditionalDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSaved ME_present=0; if ~all(diag(M_.H)==0) - if isoctave && octave_ver_less_than('6') - [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id); - else - [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable'); - end + [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable'); if ~isempty(observable_pos_requested_vars) ME_present=1; nobs_ME=length(observable_pos_requested_vars); diff --git a/matlab/dsge_simulated_theoretical_variance_decomposition.m b/matlab/dsge_simulated_theoretical_variance_decomposition.m index 5f083438e..e17865aae 100644 --- a/matlab/dsge_simulated_theoretical_variance_decomposition.m +++ b/matlab/dsge_simulated_theoretical_variance_decomposition.m @@ -18,7 +18,7 @@ function [nvar,vartan,NumberOfDecompFiles] = ... % vartan [char] array of characters (with nvar rows). % CovarFileNumber [integer] scalar, number of prior or posterior data files (for covariance). -% Copyright (C) 2007-2020 Dynare Team +% Copyright (C) 2007-2021 Dynare Team % % This file is part of Dynare. % @@ -87,11 +87,7 @@ MaXNumberOfDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSavedElementsPer ME_present=0; if ~all(diag(M_.H)==0) - if isoctave && octave_ver_less_than('6') - [observable_pos_requested_vars,index_subset,index_observables]=intersect_stable(ivar,options_.varobs_id); - else - [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable'); - end + [observable_pos_requested_vars,index_subset,index_observables]=intersect(ivar,options_.varobs_id,'stable'); if ~isempty(observable_pos_requested_vars) ME_present=1; nobs_ME=length(observable_pos_requested_vars); diff --git a/matlab/dynare.m b/matlab/dynare.m index 4df698911..57bff4d18 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -76,9 +76,9 @@ if isoctave 'of precompiled mex files and some\nfeatures, like solution ' ... 'of models approximated at third order, will not be available.'], supported_octave_version()) skipline() - elseif octave_ver_less_than('4.4') % Should match the test in mex/build/octave/configure.ac + elseif octave_ver_less_than('6.2.0') % Should match the test in mex/build/octave/configure.ac, and also the one in matlab/modules/dseries/src/initialize_dseries_class.m skipline() - warning(['This version of Dynare has only been tested on Octave 4.4 and above. Dynare may fail to run or give unexpected result. Consider upgrading your version of Octave.']) + warning(['This version of Dynare has only been tested on Octave 6.2.0 and above. Dynare may fail to run or give unexpected result. Consider upgrading your version of Octave.']) skipline() end else diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index 4d9390852..71441e1f1 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -85,17 +85,6 @@ if ~isoctave p{end+1} = '/missing/vec'; end -% ordeig() doesn't exist in Octave < 5 -if isoctave && octave_ver_less_than('5') - p{end+1} = '/missing/ordeig'; -end - -%% intersect(…, 'stable') and unique(…, 'stable') doen't exist in Octave < 6 -if isoctave && octave_ver_less_than('6') - p{end+1} = '/missing/intersect_stable'; - p{end+1} = '/missing/unique_stable'; -end - % Replacements for functions of the MATLAB statistics toolbox if isoctave % Under Octave, these functions are in the statistics Forge package. @@ -115,8 +104,8 @@ if ~exist('struct2array') p{end+1} = '/missing/struct2array'; end -% isfile is missing in Octave < 5 and Matlab < R2017b -if (isoctave && octave_ver_less_than('5')) || (~isoctave && matlab_ver_less_than('9.3')) +% isfile is missing in MATLAB < R2017b +if ~isoctave && matlab_ver_less_than('9.3') p{end+1} = '/missing/isfile'; end diff --git a/matlab/lmmcp/catstruct.m b/matlab/lmmcp/catstruct.m index a021b3ba3..6354225bd 100644 --- a/matlab/lmmcp/catstruct.m +++ b/matlab/lmmcp/catstruct.m @@ -48,7 +48,7 @@ function A = catstruct(varargin) % Copyright (C) 2005 Jos van der Geest % Copyright (C) 2013 Christophe Gouel -% Copyright (C) 2016-2020 Dynare Team +% Copyright (C) 2016-2021 Dynare Team % % Redistribution and use in source and binary forms, with or without % modification, are permitted provided that the following conditions are @@ -150,11 +150,7 @@ else FN = squeeze(FN) ; VAL = squeeze(VAL) ; MatlabVersion = version; - if isoctave && octave_ver_less_than('6') - [UFN,ind] = unique(FN) ; - else - [UFN,ind] = unique(FN,'legacy') ; - end + [UFN,ind] = unique(FN,'legacy') ; if numel(UFN) ~= numel(FN) warning('catstruct:DuplicatesFound','Fieldnames are not unique between structures.') ; diff --git a/matlab/missing/intersect_stable/intersect_stable.m b/matlab/missing/intersect_stable/intersect_stable.m deleted file mode 100644 index 9b6eb5433..000000000 --- a/matlab/missing/intersect_stable/intersect_stable.m +++ /dev/null @@ -1,91 +0,0 @@ -% Crude implementation of intersect(…, 'stable'), which is missing in Octave - -% Copyright (C) 2019 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see . - -function [c, ia, ib] = intersect_stable(a, b) - -if nargin ~= 2 - error('intersect_stable: needs exactly 2 input arguments'); -end - -if isnumeric (a) && isnumeric (b) - c = []; -elseif iscell (b) - c = {}; -else - c = ''; -end -ia = []; -ib = []; - -if isempty (a) || isempty (b) - return -else - isrowvec = isrow (a) && isrow (b); - - for i = 1:numel(a) - if iscellstr(c) - idx = strcmp(a(i), b); - else - idx = a(i) == b; - end - if any(idx) && ~ismember(a(i), c) - c = [c(:); a(i)]; - if nargout > 1 - ia = [ia, i]; - ib = [ib, find(idx)]; - end - end - end - - %% Adjust output orientation for MATLAB compatibility - if isrowvec - c = c.'; - end -end -end - -%!test -%! a = [3 4 1 5]; -%! b = [2 4 9 1 6]; -%! [c,ia,ib]=intersect_stable(a,b); -%! assert(c, [4 1]) -%! assert(ia, [2 3]) -%! assert(ib, [2 4]) -%! assert(a(ia), c) -%! assert(b(ib), c) - -%!test -%! a = [3 4 1 5]'; -%! b = [2 4 9 1 6]'; -%! [c,ia,ib]=intersect_stable(a,b); -%! assert(c, [4 1]') -%! assert(ia, [2 3]) -%! assert(ib, [2 4]) -%! assert(a(ia), c) -%! assert(b(ib), c) - -%!test -%! a = { 'defun', 'mapcar', 'let', 'eval-when'}; -%! b = { 'setf', 'let', 'list', 'cdr', 'defun'}; -%! [c,ia,ib]=intersect_stable(a,b); -%! assert(c, { 'defun', 'let' }) -%! assert(ia, [1 3]) -%! assert(ib, [5 2]) -%! assert(a(ia), c) -%! assert(b(ib), c) diff --git a/matlab/missing/ordeig/ordeig.m b/matlab/missing/ordeig/ordeig.m deleted file mode 100644 index e7ddfd744..000000000 --- a/matlab/missing/ordeig/ordeig.m +++ /dev/null @@ -1,46 +0,0 @@ -function eigs = ordeig(t) -% function eval = ordeig(t) -% Computes the eigenvalues of a quasi-triangular matrix -% -% INPUTS -% t: quasi-triangular matrix -% -% OUTPUTS -% eigs: eigenvalues -% -% SPECIAL REQUIREMENTS -% none - -% Copyright (C) 2003-2017 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see . - -n = size(t,2); -eigs = zeros(n,1); -i = 1; -while i <= n - if i == n - eigs(n) = t(n,n); - break - elseif t(i+1,i) == 0 - eigs(i) = t(i,i); - i = i+1; - else - k = i:i+1; - eigs(k) = eig(t(k,k)); - i = i+2; - end -end diff --git a/matlab/missing/unique_stable/unique_stable.m b/matlab/missing/unique_stable/unique_stable.m deleted file mode 100644 index 38ad69ee2..000000000 --- a/matlab/missing/unique_stable/unique_stable.m +++ /dev/null @@ -1,44 +0,0 @@ -% Crude implementation of unique(…, 'stable'), which is missing in Octave < 6 - -% Copyright (C) 2021 Dynare Team -% -% This file is part of Dynare. -% -% Dynare is free software: you can redistribute it and/or modify -% it under the terms of the GNU General Public License as published by -% the Free Software Foundation, either version 3 of the License, or -% (at your option) any later version. -% -% Dynare is distributed in the hope that it will be useful, -% but WITHOUT ANY WARRANTY; without even the implied warranty of -% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -% GNU General Public License for more details. -% -% You should have received a copy of the GNU General Public License -% along with Dynare. If not, see . - -function [r, idx] = unique_stable(x) - -idx = []; - -if iscell(x) - r = {}; - for i = 1:numel(x) - if ~ismember(x{i}, r) - r{end+1} = x{i}; - idx(end+1) = i; - end - end -else - r = []; - for i = 1:numel(x) - if ~ismember(x(i), r) - r(end+1) = x(i); - idx(end+1) = i; - end - end -end - -if size(x, 2) == 1 - r = r'; -end diff --git a/matlab/modules/dseries b/matlab/modules/dseries index 479460fee..a02a4ce67 160000 --- a/matlab/modules/dseries +++ b/matlab/modules/dseries @@ -1 +1 @@ -Subproject commit 479460fee64681232b696745c9f3319700def1de +Subproject commit a02a4ce6745c1e23ff9aaedd4db651c1acf3cd47 diff --git a/matlab/ols/getEquationsByTags.m b/matlab/ols/getEquationsByTags.m index 7d7c85b91..7addcc116 100644 --- a/matlab/ols/getEquationsByTags.m +++ b/matlab/ols/getEquationsByTags.m @@ -72,9 +72,5 @@ for i = 1:length(tagvalue) end end assert(~isempty(idx2keep), 'getEquationsByTags: no equations selected'); -if isoctave && octave_ver_less_than('6') - ast = ast(unique_stable(idx2keep)); -else - ast = ast(unique(idx2keep, 'stable')); -end +ast = ast(unique(idx2keep, 'stable')); end diff --git a/matlab/posterior_analysis.m b/matlab/posterior_analysis.m index 453d3b5d6..6f537e43b 100644 --- a/matlab/posterior_analysis.m +++ b/matlab/posterior_analysis.m @@ -1,6 +1,6 @@ function oo_ = posterior_analysis(type,arg1,arg2,arg3,options_,M_,oo_) -% Copyright (C) 2008-2020 Dynare Team +% Copyright (C) 2008-2021 Dynare Team % % This file is part of Dynare. % @@ -66,11 +66,7 @@ switch type M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_,options_); if ~all(diag(M_.H)==0) if strmatch(arg1,options_.varobs,'exact') - if isoctave && octave_ver_less_than('6') - [observable_name_requested_vars,index_subset,index_observables]=intersect_stable(vartan,options_.varobs); - else - [observable_name_requested_vars,index_subset,index_observables]=intersect(vartan,options_.varobs,'stable'); - end + [observable_name_requested_vars,index_subset,index_observables]=intersect(vartan,options_.varobs,'stable'); oo_ = variance_decomposition_ME_mc_analysis(SampleSize,'posterior',M_.dname,M_.fname,... [M_.exo_names;'ME'],arg2,observable_name_requested_vars,arg1,options_.mh_conf_sig,oo_,options_); end diff --git a/mex/build/octave/configure.ac b/mex/build/octave/configure.ac index fd24cb3d6..b9ffc14ce 100644 --- a/mex/build/octave/configure.ac +++ b/mex/build/octave/configure.ac @@ -39,7 +39,7 @@ LDFLAGS="$($MKOCTFILE -p LFLAGS) $($MKOCTFILE -p LDFLAGS)" AC_CANONICAL_HOST OCTAVE_VERSION=$($MKOCTFILE -v 2>&1 | sed 's/mkoctfile, version //') -AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [4.4], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 4.4 at least (or disable Octave support with --disable-octave).])]) +AX_COMPARE_VERSION([$OCTAVE_VERSION], [lt], [6.2.0], [AC_MSG_ERROR([Your Octave is too old, please upgrade to version 6.2.0 at least (or disable Octave support with --disable-octave).])]) AC_PROG_FC AC_PROG_CC diff --git a/tests/bgp/fs2000/fs2000.mod b/tests/bgp/fs2000/fs2000.mod index c7f6fd94f..bbe593f34 100644 --- a/tests/bgp/fs2000/fs2000.mod +++ b/tests/bgp/fs2000/fs2000.mod @@ -7,7 +7,7 @@ */ /* - * Copyright (C) 2019 Dynare Team + * Copyright (C) 2019-2021 Dynare Team * * This file is part of Dynare. * @@ -72,14 +72,7 @@ verbatim; else options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6); end - if isoctave && octave_ver_less_than('6') - % Octave < 6 can't take a function handle of a function in a package - % See https://savannah.gnu.org/bugs/index.php?46659 - fun = str2func('fs2000.bgpfun'); - else - fun = @fs2000.bgpfun; - end - [y, fval, exitflag] = fsolve(fun, [y;g], options); + [y, fval, exitflag] = fsolve(@fs2000.bgpfun, [y;g], options); if exitflag<1 error('Solution not found') end diff --git a/tests/bgp/nk-1/nk.mod b/tests/bgp/nk-1/nk.mod index a77a1b3da..32f8ec25f 100644 --- a/tests/bgp/nk-1/nk.mod +++ b/tests/bgp/nk-1/nk.mod @@ -29,16 +29,9 @@ verbatim; else options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8); end - if isoctave && octave_ver_less_than('6') - % Octave < 6 can't take a function handle of a function in a package - % See https://savannah.gnu.org/bugs/index.php?46659 - fun = str2func('nk.bgpfun'); - else - fun = @nk.bgpfun; - end y = 1+(rand(3,1)-.5)*.5; g = 1+(rand(3,1)-.5)*.1; - [y, fval, exitflag] = fsolve(fun, [y;g], options); + [y, fval, exitflag] = fsolve(@nk.bgpfun, [y;g], options); assert(max(abs(y-1))<1e-9); end; diff --git a/tests/bgp/ramsey-1/ramsey.mod b/tests/bgp/ramsey-1/ramsey.mod index 27b69322a..b461f6fca 100644 --- a/tests/bgp/ramsey-1/ramsey.mod +++ b/tests/bgp/ramsey-1/ramsey.mod @@ -24,16 +24,9 @@ verbatim; else options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6); end - if isoctave && octave_ver_less_than('6') - % Octave < 6 can't take a function handle of a function in a package - % See https://savannah.gnu.org/bugs/index.php?46659 - fun = str2func('ramsey.bgpfun'); - else - fun = @ramsey.bgpfun; - end y = 1+(rand(M_.endo_nbr,1)-.5)*.25; g = ones(M_.endo_nbr,1);% 1+(rand(M_.endo_nbr,1)-.5)*.1; - [y, fval, exitflag] = fsolve(fun, [y;g], options); + [y, fval, exitflag] = fsolve(@ramsey.bgpfun, [y;g], options); assert(max(abs(y(M_.endo_nbr+(1:M_.orig_endo_nbr))-1.02))<1e-6) end; diff --git a/tests/bgp/solow-1/solow.mod b/tests/bgp/solow-1/solow.mod index 3f8daed25..c5e26af32 100644 --- a/tests/bgp/solow-1/solow.mod +++ b/tests/bgp/solow-1/solow.mod @@ -55,18 +55,11 @@ verbatim; else options = optimoptions('fsolve','Display','off','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8); end - if isoctave && octave_ver_less_than('6') - % Octave < 6 can't take a function handle of a function in a package - % See https://savannah.gnu.org/bugs/index.php?46659 - fun = str2func('solow.bgpfun'); - else - fun = @solow.bgpfun; - end reverseStr = ''; for i=1:MC y = 1+(rand(6,1)-.5)*.2; g = ones(6,1); - [y, fval, exitflag] = fsolve(fun, [y;g], options); + [y, fval, exitflag] = fsolve(@solow.bgpfun, [y;g], options); if exitflag>0 KY(i) = y(6)/y(5); GY(i) = y(11); diff --git a/tests/conditional_variance_decomposition/example1.mod b/tests/conditional_variance_decomposition/example1.mod index 880a465e8..867864b16 100644 --- a/tests/conditional_variance_decomposition/example1.mod +++ b/tests/conditional_variance_decomposition/example1.mod @@ -76,11 +76,7 @@ for i=1:nvar SubsetOfVariables(i) = i_tmp; end -if isoctave && octave_ver_less_than('6') - [observable_pos,index_observables,index_subset]=intersect_stable(SubsetOfVariables,options_.varobs_id); -else - [observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable'); -end +[observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable'); y_pos=strmatch('y',var_list_,'exact'); y_pos_varobs=strmatch('y',options_.varobs,'exact'); a_pos_varobs=strmatch('a',options_.varobs,'exact'); @@ -114,11 +110,7 @@ if max(abs(sum(oo_.variance_decomposition,2)-100))>2 error(['Variance decomposition at order ',num2str(options_.order),' does not work']) end -if isoctave && octave_ver_less_than('6') - [observable_pos,index_observables,index_subset]=intersect_stable(SubsetOfVariables,options_.varobs_id); -else - [observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable'); -end +[observable_pos,index_observables,index_subset]=intersect(SubsetOfVariables,options_.varobs_id,'stable'); y_pos=strmatch('y',var_list_,'exact'); y_pos_varobs=strmatch('y',options_.varobs,'exact'); a_pos_varobs=strmatch('a',options_.varobs,'exact'); diff --git a/tests/stochastic_purely_forward/stochastic_purely_forward.mod b/tests/stochastic_purely_forward/stochastic_purely_forward.mod index 6dd03fcaf..9370e6ab7 100644 --- a/tests/stochastic_purely_forward/stochastic_purely_forward.mod +++ b/tests/stochastic_purely_forward/stochastic_purely_forward.mod @@ -19,15 +19,8 @@ end; steady; check; -% Skip test under Octave 5.1 -% ordeig() is buggy in that version (but is fixed in later ones; and in older -% ones it is absent, so we use our replacement) -if ~isoctave || octave_ver_less_than('5.1') || ~octave_ver_less_than('5.2') - stoch_simul(periods=0, irf=30, order=1); stoch_simul(periods=2000, irf=30, order=1); stoch_simul(periods=0, irf=30, order=1,hp_filter=1600); stoch_simul(periods=2000, irf=30, order=1,hp_filter=1600); - -end diff --git a/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod b/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod index 8622d890f..537416bad 100644 --- a/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod +++ b/tests/stochastic_purely_forward/stochastic_purely_forward_with_static.mod @@ -20,15 +20,8 @@ end; steady; check; -% Skip test under Octave 5.1 -% ordeig() is buggy in that version (but is fixed in later ones; and in older -% ones it is absent, so we use our replacement) -if ~isoctave || octave_ver_less_than('5.1') || ~octave_ver_less_than('5.2') - stoch_simul(periods=0, irf=30, order=1); stoch_simul(periods=2000, irf=30, order=1); stoch_simul(periods=0, irf=30, order=1,hp_filter=1600); stoch_simul(periods=2000, irf=30, order=1,hp_filter=1600); - -end