Unverified Commit 47477e15 authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

Bump minimal Octave version to 6.2.0

parent c0ccca26
......@@ -210,7 +210,7 @@ License: GPL-3+
Files: matlab/lmmcp/catstruct.m
Copyright: 2005 Jos van der Geest <jos@jasen.nl>
2013 Christophe Gouel
2016-2017 Dynare Team
2016-2021 Dynare Team
License: BSD-2-clause
Files: matlab/lmmcp/lmmcp.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);
......
......@@ -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.
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
......@@ -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
......
......@@ -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
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
......@@ -48,7 +48,7 @@ function A = catstruct(varargin)
% Copyright (C) 2005 Jos van der Geest <jos@jasen.nl>
% 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.') ;
......
% 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 <http://www.gnu.org/licenses/>.
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)
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 <http://www.gnu.org/licenses/>.
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
% 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 <http://www.gnu.org/licenses/>.
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
Subproject commit 479460fee64681232b696745c9f3319700def1de
Subproject commit a02a4ce6745c1e23ff9aaedd4db651c1acf3cd47
......@@ -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
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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment