diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a83d213468100f08423925bce77a3b45f65f0e4..0fbaa25842a48a6891f91e95f8f24aeeb8a3d1c7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,7 @@ test_matlab: test_old_matlab: stage: test variables: - MATLAB: /usr/local/MATLAB/R2009b/bin/matlab + MATLAB: /usr/local/MATLAB/R2014a/bin/matlab script: - make check-matlab diff --git a/src/@dates/intersect.m b/src/@dates/intersect.m index 5cbed03fefd3ab3c67a27c5472824e01ca4d64a5..df48770ed039ade43d04e899f6d63afdfeb52fcf 100644 --- a/src/@dates/intersect.m +++ b/src/@dates/intersect.m @@ -9,7 +9,7 @@ function q = intersect(o, p) % --*-- Unitary tests --*-- % OUTPUTS % - q [dates] All the common elements in o and p. -% Copyright (C) 2013-2017 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This code is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -38,7 +38,7 @@ if ~isequal(o.freq,p.freq) return end -if isoctave || matlab_ver_less_than('8.1.0') +if isoctave time = intersect(o.time,p.time,'rows'); else time = intersect(o.time,p.time,'rows','legacy'); diff --git a/src/@dates/remove_.m b/src/@dates/remove_.m index 5416231147003604240cf611fb6eb90d530fe078..480560a359fcdc589d56fcd0e24769bde72c31bf 100644 --- a/src/@dates/remove_.m +++ b/src/@dates/remove_.m @@ -15,7 +15,7 @@ function o = remove_(o, p) % --*-- Unitary tests --*-- % % See also pop, setdiff -% Copyright (C) 2013-2017 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This code is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -42,7 +42,7 @@ if ~isequal(o.freq,p.freq) error('dates:remove','Inputs must have common frequency!') end -if isoctave || matlab_ver_less_than('8.1.0') +if isoctave time = setdiff(o.time,p.time,'rows'); else time = setdiff(o.time,p.time,'rows','legacy'); @@ -140,4 +140,4 @@ o.time = time; %$ end %$ %$ T = all(t); -%@eof:5 \ No newline at end of file +%@eof:5 diff --git a/src/@dates/setdiff.m b/src/@dates/setdiff.m index 783cbf9eb9fc8192658112aed8e65e8123819922..c3681868945def7479c387e94b287c16f553eeef 100644 --- a/src/@dates/setdiff.m +++ b/src/@dates/setdiff.m @@ -12,7 +12,7 @@ function [q, io] = setdiff(o,p) % --*-- Unitary tests --*-- % % See also pop, remove. -% Copyright (C) 2013-2017 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This code is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ if isequal(o.length(),p.length()) && isequal(o, p) return end -if isoctave || matlab_ver_less_than('8.1.0') +if isoctave if nargout<2 time = setdiff(o.time,p.time,'rows'); else diff --git a/src/@dates/unique_.m b/src/@dates/unique_.m index dd14b4e4fcc9701102187e053062ffb8b2600a25..fec7bd46b15259746c68e2959d6fc169e4b064d9 100644 --- a/src/@dates/unique_.m +++ b/src/@dates/unique_.m @@ -11,7 +11,7 @@ function o = unique_(o) % --*-- Unitary tests --*-- % REMARKS % 1. Only the last occurence of a date is kept. -% Copyright (C) 2013-2017 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This code is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ if o.ndat()<=1 return end -if isoctave || matlab_ver_less_than('8.1.0') +if isoctave [tmp, id, jd] = unique(o.time,'rows'); else [tmp, id, jd] = unique(o.time,'rows','legacy'); @@ -94,4 +94,4 @@ o.time = o.time(sort(id),:); %$ t(3) = dassert(d.freq,e.freq); %$ end %$ T = all(t); -%@eof:1 \ No newline at end of file +%@eof:1 diff --git a/src/@dseries/dseries.m b/src/@dseries/dseries.m index 6738ba1a06aa14e78da9f7548f671bb128420cf9..3097274ceba84782bf6cfa65b3a4b88a519b9171 100644 --- a/src/@dseries/dseries.m +++ b/src/@dseries/dseries.m @@ -2,7 +2,7 @@ classdef dseries<handle % --*-- Unitary tests --*-- % Class for time series. -% Copyright (C) 2013-2019 Dynare Team +% Copyright (C) 2013-2020 Dynare Team % % This code is free software: you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -66,7 +66,7 @@ methods elseif ischar(varargin{1}) [init, o.data, o.name, o.tex, o.ops, o.tags] = load_data(varargin{1}); o.dates = init:init+(nobs(o)-1); - elseif ~isoctave() && ~matlab_ver_less_than('8.2') && istable(varargin{1}) + elseif ~isoctave() && istable(varargin{1}) % It is assumed that the dates are in the first column. o.name = varargin{1}.Properties.VariableNames(2:end); o.tex = name2tex(o.name); diff --git a/src/initialize_dseries_class.m b/src/initialize_dseries_class.m index dfa28d73a5f3837c90b0539a8bcbf8dc91d64baf..8ac05c5b38491879e52d0a62f777b9e51ee43c0a 100644 --- a/src/initialize_dseries_class.m +++ b/src/initialize_dseries_class.m @@ -90,26 +90,6 @@ if ~exist('one_sided_hp_filter','file') p{end+1} = 'utilities/missing/one_sided_hp_filter'; end -if ~exist('OCTAVE_VERSION', 'builtin') && ~exist('ismatrix','builtin') - p{end+1} = 'utilities/missing/ismatrix'; -end - -if ~exist('OCTAVE_VERSION', 'builtin') && ~exist('isrow','builtin') - p{end+1} = 'utilities/missing/isrow'; -end - -if ~exist('OCTAVE_VERSION', 'builtin') && ~exist('iscolumn','builtin') - p{end+1} = 'utilities/missing/iscolumn'; -end - -if ~exist('OCTAVE_VERSION', 'builtin') && ~exist('strsplit','file') - p{end+1} = 'utilities/missing/strsplit'; -end - -if ~exist('OCTAVE_VERSION', 'builtin') && ~exist('strjoin','file') - p{end+1} = 'utilities/missing/strjoin'; -end - if ~exist('nanmean','file') p{end+1} = 'utilities/missing/nanmean'; end diff --git a/src/utilities/missing/iscolumn/iscolumn.m b/src/utilities/missing/iscolumn/iscolumn.m deleted file mode 100644 index 0264efe198287e63a59ace53cd068b8376ceefda..0000000000000000000000000000000000000000 --- a/src/utilities/missing/iscolumn/iscolumn.m +++ /dev/null @@ -1,20 +0,0 @@ -function r = iscolumn(V) -% Copyright (C) 2018 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/>. - -sz = size(V); -r = (length(sz) == 2) && (sz(2) == 1); diff --git a/src/utilities/missing/ismatrix/ismatrix.m b/src/utilities/missing/ismatrix/ismatrix.m deleted file mode 100644 index e9ed4ef2dbab191420bc7fa851e6aba8744f8de3..0000000000000000000000000000000000000000 --- a/src/utilities/missing/ismatrix/ismatrix.m +++ /dev/null @@ -1,19 +0,0 @@ -function r = ismatrix(V) -% Copyright (C) 2018 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/>. - -r = (ndims(V) == 2); diff --git a/src/utilities/missing/isrow/isrow.m b/src/utilities/missing/isrow/isrow.m deleted file mode 100644 index ef53534ede0596453d55e1d7fc36ed66499816b4..0000000000000000000000000000000000000000 --- a/src/utilities/missing/isrow/isrow.m +++ /dev/null @@ -1,20 +0,0 @@ -function r = isrow(V) -% Copyright (C) 2018 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/>. - -sz = size(V); -r = (length(sz) == 2) && (sz(1) == 1); diff --git a/src/utilities/missing/strjoin/strjoin.m b/src/utilities/missing/strjoin/strjoin.m deleted file mode 100644 index 666c5f83a3bf8f5d0c817da62e3f7d5b449bb650..0000000000000000000000000000000000000000 --- a/src/utilities/missing/strjoin/strjoin.m +++ /dev/null @@ -1,63 +0,0 @@ -function rval = strjoin (cstr, delimiter) - -% Adapted from Octave's implementation of strjoin -% -% Limitation: escaped characters (e.g. '\n') in delimiters will not be -% interpreted as the characters they represent. - -% Copyright (C) 2013-2019 Ben Abbott -% Copyright (C) 2007 Muthiah Annamalai -% 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/>. - -if nargin == 1 - delimiter = ' '; -elseif nargin < 1 || nargin > 2 - error('strjoin: must have either one or two arguments') -end -if ~(iscellstr(cstr) && (ischar(delimiter) || iscellstr(delimiter))) - error('strjoin: first argument must be a cell array, second array either a char array or a cell array') -end - -if numel(cstr) == 1 - rval = cstr{1}; - return; -end - -if ischar(delimiter) - % There is no equivalent to do_string_escapes in MATLAB - %delimiter = do_string_escapes(delimiter); - delimiter = {delimiter}; -end - -num = numel(cstr); -if numel(delimiter) == 1 && num > 1 - delimiter = repmat(delimiter, 1, num); - delimiter(end) = {''}; -elseif num > 0 && numel(delimiter) ~= num - 1 - error('strjoin: the number of delimiters does not match the number of strings'); -else - delimiter(end+1) = {''}; -end - -if num == 0 - rval = ''; -else - tmp = [cstr(:).'; delimiter(:).']; - rval = [tmp{:}]; -end - diff --git a/src/utilities/missing/strsplit/private/ischarint.m b/src/utilities/missing/strsplit/private/ischarint.m deleted file mode 100644 index d325015d4d05a60b063dbd6b17767041c4e02441..0000000000000000000000000000000000000000 --- a/src/utilities/missing/strsplit/private/ischarint.m +++ /dev/null @@ -1,27 +0,0 @@ -function l = ischarint(x) - -% Returns true if and only if char x represents an integer. - -% Copyright © 2018 DynareTeam -% -% 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/>. - -s = warning; -warning off; - -l = isint(str2double(x)); - -warning(s); \ No newline at end of file diff --git a/src/utilities/missing/strsplit/private/ischarnum.m b/src/utilities/missing/strsplit/private/ischarnum.m deleted file mode 100644 index 57b7c7e8cd308c6e400b76f49b88b61fad83dad3..0000000000000000000000000000000000000000 --- a/src/utilities/missing/strsplit/private/ischarnum.m +++ /dev/null @@ -1,35 +0,0 @@ -function l = ischarnum(x) - -% Returns true if and only if char x represents a real number. - -% Copyright © 2018 DynareTeam -% -% 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/>. - -l = false; - -s = warning; -warning off; - -number = str2double(x); - -warning(s); - -if ~isempty(number) - if isreal(number) - l = true; - end -end \ No newline at end of file diff --git a/src/utilities/missing/strsplit/strsplit.m b/src/utilities/missing/strsplit/strsplit.m deleted file mode 100644 index 926bb50f389c6a7bb95818f3005856cab2e853fb..0000000000000000000000000000000000000000 --- a/src/utilities/missing/strsplit/strsplit.m +++ /dev/null @@ -1,90 +0,0 @@ -function tok = strsplit(str, delimiters) - -% Splits a string into multiple terms. -% -% INPUTS -% - str [char] String to be splitted. -% - delimiters [char, cell(char)] Delimiters. -% -% OUTPUTS -% - tok [cell(char)] Terms. - -% Copyright © 2018 DynareTeam -% -% 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/>. - -remove_empty = true; -remove_numbers = false; - -% Check first input arguments -assert(ischar(str) && ndims(str)==2 && size(str,1)<=1, 'The first arugment has to be a row char array!'); - -% Set default value for second input arguments -if nargin<2 - delimiters = {' '}; -end - -% If second input argument is a char transform it into a sigleton cell of char -if nargin>1 - if ischar(delimiters) - assert(ndims(delimiters)==2 && size(delimiters,1)==1, 'The second input argument has to be be a char string!'); - delimiters = {delimiters}; - end -end - -% Check that `delimiters` is a one dimensional cell -assert(ndim(delimiters)<=1, 'The second input argument has to be a one dimensional cell array!') - -% Check that `delimiters` is a cell of row char arrays -assert(all(cellfun(@ischar, delimiters)) && all(cellfun(@rows, delimiters)==1), 'The second input argument has to be a cell of row char arrays!') - -% If space is one of the delimiters obtain the index in `delimiters` -idspace = strmatch(' ', delimiters); - -% Get the number of delimiters -n = length(delimiters); - -% Remove unnecessary spaces -delimiters(setdiff(1:n, idspace)) = strtrim(delimiters(setdiff(1:n, idspace))); - -% Join all the delimiters (strjoin is not available with matlab version less than R2013a) -if n>1 - delimiter = ''; - for i=1:n - if isspace(delimiters{i}) - delimiter = horzcat(delimiter, '\s'); - else - delimiter = horzcat(delimiter, delimiters{i}); - end - delimiter = horzcat(delimiter,'|'); - end - delimiter = horzcat(delimiter, '\W'); -else - delimiter = delimiters{1}; -end - -% Get tokens -tok = regexp(str, delimiter, 'split'); - -if remove_empty - % Remove empty tokens - tok = tok(find(~cellfun(@isempty, tok))); -end - -if remove_numbers - % Remove numbers - tok = tok(find(~cellfun(@ischarnum, tok))); -end \ No newline at end of file