diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 33f4a41d4..8b5e30945 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: GIT_SUBMODULE_STRATEGY: recursive TERM: linux MATLAB_VERSION: R2020a - OLD_MATLAB_VERSION: R2009b + OLD_MATLAB_VERSION: R2014a # The next stanza creates the version number used for the source tarball and the # binary packages. Here are the following possible cases: diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index 49651c579..0de229401 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -14,7 +14,7 @@ are necessary in that case. In order to run Dynare, you need one of the following: -* MATLAB version 7.9 (R2009b) or above; +* MATLAB version 8.3 (R2014a) or above; * GNU Octave version 4.4 or above, with the statistics package from `Octave-Forge`_. Note however that the Dynare installers for Windows and macOS require a more specific version of Octave, as indicated on the download diff --git a/license.txt b/license.txt index 5bda147d2..18e5e35bb 100644 --- a/license.txt +++ b/license.txt @@ -207,12 +207,6 @@ Copyright: 1993-1996 Kurt Hornik 2016-2017 Dynare Team License: GPL-3+ -Files: matlab/missing/strjoin/strjoin.m -Copyright: 2013-2019 Ben Abbott - 2007 Muthiah Annamalai - 2019 Dynare Team -License: GPL-3+ - Files: matlab/lmmcp/catstruct.m Copyright: 2005 Jos van der Geest 2013 Christophe Gouel diff --git a/m4/ax_mexopts.m4 b/m4/ax_mexopts.m4 index 890397b61..60fda3441 100644 --- a/m4/ax_mexopts.m4 +++ b/m4/ax_mexopts.m4 @@ -22,7 +22,7 @@ AC_REQUIRE([AX_MATLAB_ARCH]) AC_REQUIRE([AX_MATLAB_VERSION]) AC_REQUIRE([AC_PROG_SED]) -AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 7.9 (R2009b) at least.])]) +AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [8.3], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to 8.3 (R2014a) at least.])]) AC_MSG_CHECKING([for options to compile MEX for MATLAB]) @@ -80,10 +80,6 @@ case ${MATLAB_ARCH} in ;; esac -# Kludge for incompatibility of older MATLABs (≤ R2011a) with recent gcc -# Include , because matrix.h needs char16_t -AX_COMPARE_VERSION([$MATLAB_VERSION], [le], [7.12], [MATLAB_CFLAGS="$MATLAB_CFLAGS -include uchar.h"]) - # Converts the MATLAB version number into comparable integers with only major and minor version numbers # For example, 7.4.2 will become 0704 ax_matlab_ver=$(echo "$MATLAB_VERSION" | $SED -e 's/\([[0-9]]*\)\.\([[0-9]]*\).*/Z\1ZZ\2Z/' \ diff --git a/macOS/build.sh b/macOS/build.sh index 55b78f7ca..c6af350ab 100755 --- a/macOS/build.sh +++ b/macOS/build.sh @@ -88,7 +88,7 @@ make -j"$NTHREADS" NAME=dynare-"$VERSION" PKGFILES="$ROOTDIR"/macOS/pkg/"$NAME" mkdir -p \ - "$PKGFILES"/mex/matlab/maci64-7.9-9.3 \ + "$PKGFILES"/mex/matlab/maci64-8.3-9.3 \ "$PKGFILES"/mex/matlab/maci64-9.4-9.8 \ "$PKGFILES"/mex/octave \ "$PKGFILES"/doc/dynare++ \ @@ -107,7 +107,7 @@ cp -p "$ROOTDIR"/license.txt "$PKGFILES" cp -pr "$ROOTDIR"/matlab "$PKGFILES" cp -pr "$ROOTDIR"/examples "$PKGFILES" -cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-7.9-9.3 +cp -L "$ROOTDIR"/mex/matlab/* "$PKGFILES"/mex/matlab/maci64-8.3-9.3 cp -p "$ROOTDIR"/scripts/dynare.el "$PKGFILES"/scripts cp -pr "$ROOTDIR"/contrib/ms-sbvar/TZcode/MatlabFiles "$PKGFILES"/contrib/ms-sbvar/TZcode diff --git a/matlab/add_path_to_mex_files.m b/matlab/add_path_to_mex_files.m index 85f259303..0f0c4abd8 100644 --- a/matlab/add_path_to_mex_files.m +++ b/matlab/add_path_to_mex_files.m @@ -1,6 +1,6 @@ function mexpath = add_path_to_mex_files(dynareroot, modifypath) -% Copyright (C) 2015-2019 Dynare Team +% Copyright (C) 2015-2020 Dynare Team % % This file is part of Dynare. % @@ -54,7 +54,7 @@ if isoctave else % Add win32 specific paths for Dynare Windows package if strcmp(computer, 'PCWIN') - tmp = [dynareroot '../mex/matlab/win32-7.9-8.6/']; + tmp = [dynareroot '../mex/matlab/win32-8.3-8.6/']; if exist(tmp, 'dir') mexpath = tmp; if modifypath @@ -65,7 +65,7 @@ else % Add win64 specific paths for Dynare Windows package if strcmp(computer, 'PCWIN64') if matlab_ver_less_than('9.4') - tmp = [dynareroot '../mex/matlab/win64-7.9-9.3/']; + tmp = [dynareroot '../mex/matlab/win64-8.3-9.3/']; if exist(tmp, 'dir') mexpath = tmp; if modifypath @@ -85,7 +85,7 @@ else % Add macOS paths for Dynare Mac package if strcmp(computer, 'MACI64') if matlab_ver_less_than('9.4') - tmp = [dynareroot '../mex/matlab/maci64-7.9-9.3/']; + tmp = [dynareroot '../mex/matlab/maci64-8.3-9.3/']; if exist(tmp, 'dir') mexpath = tmp; if modifypath diff --git a/matlab/compute_moments_varendo.m b/matlab/compute_moments_varendo.m index 4bfabce34..21f5201f0 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-2018 Dynare Team +% Copyright (C) 2008-2020 Dynare Team % % This file is part of Dynare. % @@ -145,7 +145,7 @@ if M_.exo_nbr > 1 end skipline(); if ~all(M_.H==0) - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); diff --git a/matlab/conditional_variance_decomposition.m b/matlab/conditional_variance_decomposition.m index 4ef81da55..45fe803bd 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-2017 Dynare Team +% Copyright (C) 2010-2020 Dynare Team % % This file is part of Dynare. % @@ -89,7 +89,7 @@ end % Measurement error if ~all(StateSpaceModel.measurement_error==0) - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); diff --git a/matlab/conditional_variance_decomposition_ME_mc_analysis.m b/matlab/conditional_variance_decomposition_ME_mc_analysis.m index cfe9a1b15..a0b5ffdd7 100644 --- a/matlab/conditional_variance_decomposition_ME_mc_analysis.m +++ b/matlab/conditional_variance_decomposition_ME_mc_analysis.m @@ -22,7 +22,7 @@ function oo_ = ... % OUTPUTS % oo_ [structure] Dynare structure where the results are saved. -% Copyright (C) 2017-2018 Dynare Team +% Copyright (C) 2017-2020 Dynare Team % % This file is part of Dynare. % @@ -63,7 +63,7 @@ if isempty(exogenous_variable_index) end end -if isoctave || matlab_ver_less_than('8.1') +if isoctave [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'); diff --git a/matlab/disp_moments.m b/matlab/disp_moments.m index 8223ba4f9..cd819cb99 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-2019 Dynare Team +% Copyright (C) 2001-2020 Dynare Team % % This file is part of Dynare. % @@ -50,7 +50,7 @@ y = y(ivar,options_.drop+1:end)'; ME_present=0; if ~all(M_.H==0) - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); diff --git a/matlab/disp_th_moments.m b/matlab/disp_th_moments.m index 33fdb7100..6fd28a0d6 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-2018 Dynare Team +% Copyright (C) 2001-2020 Dynare Team % % This file is part of Dynare. % @@ -55,7 +55,7 @@ oo_.var = oo_.gamma_y{1}; ME_present=0; if ~all(M_.H==0) - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); @@ -105,7 +105,7 @@ if size(stationary_vars, 1) > 0 lh = cellofchararraymaxlength(M_.endo_names(ivar(stationary_vars)))+2; dyntable(options_, title, headers, M_.endo_names(ivar(stationary_vars)), 100*oo_.gamma_y{options_.ar+2}(stationary_vars,:), lh, 8, 2); if ME_present - if isoctave || matlab_ver_less_than('8.1') + if isoctave [stationary_observables, pos_index_subset] = intersect_stable(index_subset, stationary_vars); else [stationary_observables, pos_index_subset] = intersect(index_subset, stationary_vars, 'stable'); diff --git a/matlab/distributions/lpdfgweibull.m b/matlab/distributions/lpdfgweibull.m index 7848b3546..5d31e2380 100644 --- a/matlab/distributions/lpdfgweibull.m +++ b/matlab/distributions/lpdfgweibull.m @@ -16,7 +16,7 @@ function [ldens,Dldens,D2ldens] = lpdfgweibull(x,a,b,c) % --*-- Unitary tests - % SPECIAL REQUIREMENTS % none -% Copyright (C) 2015-2017 Dynare Team +% Copyright (C) 2015-2020 Dynare Team % % This file is part of Dynare. % @@ -205,7 +205,7 @@ end %$ density = @(x) exp(lpdfgweibull(x,shape,scale)); %$ %$ try -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s = quadl(density, .0000000001, 100000, 1e-10); %$ else %$ s = integral(density, 0, 100000); @@ -228,7 +228,7 @@ end %$ density = @(x) exp(lpdfgweibull(x,shape,scale)); %$ %$ try -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s = quadl(density, .0000000001, 100000, 1e-10); %$ else %$ s = integral(density, 0, 100000); @@ -251,7 +251,7 @@ end %$ density = @(x) exp(lpdfgweibull(x,shape,scale)); %$ %$ try -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s = quadl(density, .0000000001, 100000, 1e-10); %$ else %$ s = integral(density, 0, 100000); @@ -262,7 +262,7 @@ end %$ end %$ %$ if t(1) -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ t(2) = abs(s-1)<5e-5; %$ else %$ t(2) = abs(s-1)<1e-6; @@ -280,8 +280,6 @@ end %$ try %$ if isoctave %$ s = quadgk(xdens, .0000000001, 100000, 1e-10); -%$ elseif matlab_ver_less_than('7.14') -%$ s = quadgk(xdens, .0000000001, 100000, 'AbsTol', 1e-10); %$ else %$ s = integral(xdens, 0, 100000); %$ end @@ -303,7 +301,7 @@ end %$ xdens = @(x) x.*exp(lpdfgweibull(x,shape,scale)); %$ %$ try -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s = quadl(xdens, .0000000001, 100000, 1e-10); %$ else %$ s = integral(xdens, 0, 100000); @@ -326,7 +324,7 @@ end %$ xdens = @(x) x.*exp(lpdfgweibull(x,shape,scale)); %$ %$ try -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s = quadl(xdens, .0000000001, 100000, 1e-10); %$ else %$ s = integral(xdens, 0, 100000); @@ -352,7 +350,7 @@ end %$ try %$ s = NaN(n, 1); %$ for i=1:n -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s(i) = quadl(density, .0000000001, .1*i, 1e-10); %$ else %$ s(i) = integral(density, 0, .1*i); @@ -383,7 +381,7 @@ end %$ try %$ s = NaN(n, 1); %$ for i=1:n -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s(i) = quadl(density, .0000000001, .1*i, 1e-10); %$ else %$ s(i) = integral(density, 0, .1*i); @@ -414,7 +412,7 @@ end %$ try %$ s = NaN(n, 1); %$ for i=1:n -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s(i) = quadl(density, .0000000001, .1*i, 1e-10); %$ else %$ s(i) = integral(density, 0, .1*i); @@ -429,7 +427,7 @@ end %$ for i=1:n %$ x = .1*i; %$ q = 1-exp(-(x/scale)^shape); -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ t(i+1) = abs(s(i)-q)<5e-5; %$ else %$ t(i+1) = abs(s(i)-q)<1e-6; diff --git a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m index 540b2e239..4195b58a9 100644 --- a/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m +++ b/matlab/dsge_simulated_theoretical_conditional_variance_decomposition.m @@ -83,7 +83,7 @@ MaXNumberOfConditionalDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSaved ME_present=0; if ~all(M_.H==0) - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); diff --git a/matlab/dsge_simulated_theoretical_variance_decomposition.m b/matlab/dsge_simulated_theoretical_variance_decomposition.m index 7e6942c19..71febcf47 100644 --- a/matlab/dsge_simulated_theoretical_variance_decomposition.m +++ b/matlab/dsge_simulated_theoretical_variance_decomposition.m @@ -86,7 +86,7 @@ MaXNumberOfDecompLines = ceil(options_.MaxNumberOfBytes/NumberOfSavedElementsPer ME_present=0; if ~all(M_.H==0) - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); diff --git a/matlab/dynare.m b/matlab/dynare.m index 32ea530d9..27b027d67 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -82,10 +82,10 @@ if isoctave skipline() end else - if matlab_ver_less_than('7.9') % Should match the test in mex/build/matlab/configure.ac + if matlab_ver_less_than('8.3') % Should match the test in mex/build/matlab/configure.ac % and in m4/ax_mexopts.m4 skipline() - warning('This version of Dynare has only been tested on MATLAB 7.9 (R2009b) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.'); + warning('This version of Dynare has only been tested on MATLAB 8.3 (R2014a) and above. Since your MATLAB version is older than that, Dynare may fail to run, or give unexpected results. Consider upgrading your MATLAB installation, or switch to Octave.'); skipline() end end diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index 8a08d72b7..ee74ebf11 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -87,8 +87,8 @@ if isoctave && octave_ver_less_than('5') p{end+1} = '/missing/ordeig'; end -%% intersect(…, 'stable') doesn't exist in Octave and in MATLAB < R2013a -if isoctave || matlab_ver_less_than('8.1') +%% intersect(…, 'stable') doesn't exist in Octave +if isoctave p{end+1} = '/missing/intersect_stable'; end @@ -116,33 +116,12 @@ if (isoctave && octave_ver_less_than('5')) || (~isoctave && matlab_ver_less_than p{end+1} = '/missing/isfile'; end -% strsplit and strjoin are missing in MATLAB < R2013a -if ~isoctave && matlab_ver_less_than('8.1') - p{end+1} = '/missing/strsplit'; - p{end+1} = '/missing/strjoin'; -end - % contains and splitlines don't exist in Octave and in MATLAB < R2016b if isoctave || matlab_ver_less_than('9.1') p{end+1} = '/missing/contains'; p{end+1} = '/missing/splitlines'; end -% isrow, iscolumn and ismatrix are missing in Matlab. -matlab_random_streams = ~isoctave; - -if matlab_random_streams% Use new matlab interface. - if matlab_ver_less_than('7.12') - s = RandStream.getDefaultStream(); - else - s = RandStream.getGlobalStream(); - end +if ~isoctave + s = RandStream.getGlobalStream(); if isequal(s.Type,'legacy') state_u = rand('state'); state_n = randn('state'); @@ -38,7 +32,7 @@ if matlab_random_streams% Use new matlab interface. state_u = s.State; state_n = state_u; end -else% Use old matlab interface. +else state_u = rand('state'); state_n = randn('state'); -end \ No newline at end of file +end diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index 75d429182..a8a9c7e17 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -327,7 +327,7 @@ if info(1) == 0 %no errors in solution cmm = simulated_moment_uncertainty(ind_dMOMENTS, periods, replic,options_,M_,oo_); %covariance matrix of moments sd = sqrt(diag(cmm)); cc = cmm./(sd*sd'); - if isoctave || matlab_ver_less_than('8.3') + if isoctave [VV,DD] = eig(cc); %fix for older Matlab versions that do not support computing left eigenvalues, see http://mathworks.com/help/releases/R2012b/matlab/ref/eig.html [WW,~] = eig(cc.'); @@ -536,4 +536,4 @@ if info(1) == 0 %no errors in solution identification_checks(tilda_dSPECTRUM, 3, tol_rank, tol_sv, totparam_nbr); end end -end \ No newline at end of file +end diff --git a/matlab/missing/is-row-column-matrix/iscolumn.m b/matlab/missing/is-row-column-matrix/iscolumn.m deleted file mode 100644 index 0264efe19..000000000 --- a/matlab/missing/is-row-column-matrix/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 . - -sz = size(V); -r = (length(sz) == 2) && (sz(2) == 1); diff --git a/matlab/missing/is-row-column-matrix/ismatrix.m b/matlab/missing/is-row-column-matrix/ismatrix.m deleted file mode 100644 index e9ed4ef2d..000000000 --- a/matlab/missing/is-row-column-matrix/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 . - -r = (ndims(V) == 2); diff --git a/matlab/missing/is-row-column-matrix/isrow.m b/matlab/missing/is-row-column-matrix/isrow.m deleted file mode 100644 index ef53534ed..000000000 --- a/matlab/missing/is-row-column-matrix/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 . - -sz = size(V); -r = (length(sz) == 2) && (sz(1) == 1); diff --git a/matlab/missing/isdiag/isdiag.m b/matlab/missing/isdiag/isdiag.m deleted file mode 100644 index 89dcec2f1..000000000 --- a/matlab/missing/isdiag/isdiag.m +++ /dev/null @@ -1,62 +0,0 @@ -function b = isdiag(A) % --*-- Unitary tests --*-- - -% Copyright (C) 2014-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 . - -if isnumeric(A) - if isquare(A) - % Find non zero elements in matrix A... - [ir, ic] = find(A); - % If the non zero elements are on the diagonal, the corresponding elements - % in ir and ic (row and column numbers) should be equal. - b = isequal(ir, ic); - else - error('isdiag: Input must be a square matrix!') - end -else - error('isdiag: Input must be numeric!') -end - -%@test:1 -%$ A = zeros(3,3); -%$ t = isdiag(A); -%$ T = all(t); -%@eof:1 - -%@test:2 -%$ A = zeros(3,3); A(1,3) = 1; -%$ t = ~isdiag(A); -%$ T = all(t); -%@eof:2 - -%@test:3 -%$ A = randn(3,3); -%$ t = ~isdiag(A); -%$ T = all(t); -%@eof:3 - -%@test:4 -%$ A = diag(randn(3,1)); -%$ t = isdiag(A); -%$ T = all(t); -%@eof:4 - -%@test:5 -%$ A = diag(randn(3,1)); A(1,1) = 0; -%$ t = isdiag(A); -%$ T = all(t); -%@eof:5 diff --git a/matlab/missing/narginchk/narginchk.m b/matlab/missing/narginchk/narginchk.m deleted file mode 100644 index 645f3afaa..000000000 --- a/matlab/missing/narginchk/narginchk.m +++ /dev/null @@ -1,28 +0,0 @@ -function narginchk(minArgs,maxArgs) - -% 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 . - -n = evalin('caller', 'nargin;'); - -if n < minArgs - error('narginchk: not enough input arguments'); -end - -if n > maxArgs - error('narginchk: too many input arguments'); -end diff --git a/matlab/missing/stats/wblinv.m b/matlab/missing/stats/wblinv.m index 105a6cf7e..af537a7c3 100644 --- a/matlab/missing/stats/wblinv.m +++ b/matlab/missing/stats/wblinv.m @@ -10,7 +10,7 @@ function t = wblinv(proba, scale, shape) % --*-- Unitary tests --*-- % OUTPUTS % - t [double] scalar such that P(X<=t)=proba -% Copyright (C) 2015-2017 Dynare Team +% Copyright (C) 2015-2020 Dynare Team % % This file is part of Dynare. % @@ -147,7 +147,7 @@ t = exp(log(scale)+log(-log(1-proba))/shape); %$ if debug %$ [shape, scale, x(k-1)] %$ end -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ s = quadv(density, 0, x(k-1),1e-10); %$ else %$ s = integral(density, 0, x(k-1)); @@ -155,7 +155,7 @@ t = exp(log(scale)+log(-log(1-proba))/shape); %$ if debug %$ [s, abs(p-s)] %$ end -%$ if isoctave || matlab_ver_less_than('7.14') +%$ if isoctave %$ t(k) = abs(p-s)<1e-9; %$ else %$ t(k) = abs(p-s)<1e-12; diff --git a/matlab/missing/strjoin/strjoin.m b/matlab/missing/strjoin/strjoin.m deleted file mode 100644 index 47f21287f..000000000 --- a/matlab/missing/strjoin/strjoin.m +++ /dev/null @@ -1,62 +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 . - -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/matlab/missing/strsplit/private/ischarint.m b/matlab/missing/strsplit/private/ischarint.m deleted file mode 100644 index d325015d4..000000000 --- a/matlab/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 . - -s = warning; -warning off; - -l = isint(str2double(x)); - -warning(s); \ No newline at end of file diff --git a/matlab/missing/strsplit/private/ischarnum.m b/matlab/missing/strsplit/private/ischarnum.m deleted file mode 100644 index 57b7c7e8c..000000000 --- a/matlab/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 . - -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/matlab/missing/strsplit/strsplit.m b/matlab/missing/strsplit/strsplit.m deleted file mode 100644 index 926bb50f3..000000000 --- a/matlab/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 . - -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 diff --git a/matlab/modules/dseries b/matlab/modules/dseries index 59739c38d..a4479b5cb 160000 --- a/matlab/modules/dseries +++ b/matlab/modules/dseries @@ -1 +1 @@ -Subproject commit 59739c38d9253990dddf8f6a7c88a81f6a72d66b +Subproject commit a4479b5cb56b0f2b83d567652735c5410254f0fb diff --git a/matlab/modules/reporting b/matlab/modules/reporting index a25d3abdb..13c98b256 160000 --- a/matlab/modules/reporting +++ b/matlab/modules/reporting @@ -1 +1 @@ -Subproject commit a25d3abdb6312d619352a7b276c70ec98b3d5f00 +Subproject commit 13c98b256d8d42f62692aa9d48d379e897f2ca5e diff --git a/matlab/posterior_analysis.m b/matlab/posterior_analysis.m index 16088823d..65735025c 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-2018 Dynare Team +% Copyright (C) 2008-2020 Dynare Team % % This file is part of Dynare. % @@ -66,7 +66,7 @@ switch type M_.exo_names,arg2,vartan,arg1,options_.mh_conf_sig,oo_,options_); if ~all(M_.H==0) if strmatch(arg1,options_.varobs,'exact') - if isoctave || matlab_ver_less_than('8.1') + if isoctave [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'); diff --git a/matlab/set_dynare_random_generator_state.m b/matlab/set_dynare_random_generator_state.m index 8854576d9..03df1cb51 100644 --- a/matlab/set_dynare_random_generator_state.m +++ b/matlab/set_dynare_random_generator_state.m @@ -6,7 +6,7 @@ function [state_u,state_n] = set_dynare_random_generator_state(state_u,state_n) % For backward compatibility, we return two vectors, but, in recent % versions of Matlab and in Octave, we return two identical vectors. % -% Copyright (C) 2010-2017 Dynare Team +% Copyright (C) 2010-2020 Dynare Team % % This file is part of Dynare. % @@ -23,14 +23,8 @@ function [state_u,state_n] = set_dynare_random_generator_state(state_u,state_n) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -matlab_random_streams = ~isoctave; - -if matlab_random_streams% Use new matlab interface. - if matlab_ver_less_than('7.12') - s = RandStream.getDefaultStream(); - else - s = RandStream.getGlobalStream(); - end +if ~isoctave + s = RandStream.getGlobalStream(); if isequal(s.Type,'legacy') rand('state',state_u); randn('state',state_n); @@ -47,13 +41,9 @@ if matlab_random_streams% Use new matlab interface. 'please, contact Dynare''s development team.']) end s.State = state_u; - if matlab_ver_less_than('7.12') - RandStream.setDefaultStream(s); - else - RandStream.setGlobalStream(s); - end + RandStream.setGlobalStream(s); end -else% Use old matlab interface. +else rand('state',state_u); randn('state',state_n); -end \ No newline at end of file +end diff --git a/matlab/set_dynare_seed.m b/matlab/set_dynare_seed.m index 89feb1961..dd6b117f2 100644 --- a/matlab/set_dynare_seed.m +++ b/matlab/set_dynare_seed.m @@ -2,7 +2,7 @@ function set_dynare_seed(a,b) % Set seeds depending on matlab (octave) version. This routine is called in dynare_config and can be called by the % user in the mod file. % -% Copyright (C) 2010-2017 Dynare Team +% Copyright (C) 2010-2020 Dynare Team % % This file is part of Dynare. % @@ -32,20 +32,12 @@ if matlab_random_streams% Use new matlab interface. options_.DynareRandomStreams.algo = 'mt19937ar'; options_.DynareRandomStreams.seed = 0; s = RandStream(options_.DynareRandomStreams.algo,'Seed',options_.DynareRandomStreams.seed); - if matlab_ver_less_than('7.12') - reset(RandStream.setDefaultStream(s)); - else - reset(RandStream.setGlobalStream(s)); - end + reset(RandStream.setGlobalStream(s)); return end if ischar(a) && strcmpi(a,'reset') s = RandStream(options_.DynareRandomStreams.algo,'Seed',options_.DynareRandomStreams.seed); - if matlab_ver_less_than('7.12') - reset(RandStream.setDefaultStream(s)); - else - reset(RandStream.setGlobalStream(s)); - end + reset(RandStream.setGlobalStream(s)); return end if ~ischar(a) || (ischar(a) && strcmpi(a, 'clock')) @@ -56,11 +48,7 @@ if matlab_random_streams% Use new matlab interface. options_.DynareRandomStreams.seed = a; end s = RandStream(options_.DynareRandomStreams.algo,'Seed',options_.DynareRandomStreams.seed); - if matlab_ver_less_than('7.12') - reset(RandStream.setDefaultStream(s)); - else - reset(RandStream.setGlobalStream(s)); - end + reset(RandStream.setGlobalStream(s)); return end error('set_dynare_seed:: something is wrong in the calling sequence!') @@ -84,11 +72,7 @@ if matlab_random_streams% Use new matlab interface. options_.DynareRandomStreams.algo = a; options_.DynareRandomStreams.seed = b; s = RandStream(options_.DynareRandomStreams.algo,'Seed',options_.DynareRandomStreams.seed); - if matlab_ver_less_than('7.12') - reset(RandStream.setDefaultStream(s)); - else - reset(RandStream.setGlobalStream(s)); - end + reset(RandStream.setGlobalStream(s)); end else% Use old matlab interface. if nargin==1 @@ -122,4 +106,4 @@ else% Use old matlab interface. else error('set_dynare_seed:: Cannot use more than one input argument with your version of Matlab/Octave!') end -end \ No newline at end of file +end diff --git a/matlab/simulated_moments_estimation.m b/matlab/simulated_moments_estimation.m index 4a99ec77e..459b6a006 100644 --- a/matlab/simulated_moments_estimation.m +++ b/matlab/simulated_moments_estimation.m @@ -14,7 +14,7 @@ function [param,sigma] = simulated_moments_estimation(dataset,options,parallel) % SPECIAL REQUIREMENTS % The user has to provide a file where the moment conditions are defined. -% Copyright (C) 2010-2018 Dynare Team +% Copyright (C) 2010-2020 Dynare Team % % This file is part of Dynare. % @@ -269,11 +269,7 @@ fprintf(fid,['tmp([' num2str(variance_idx) ']) = xparams(1:' int2str(nv) ').^2; fprintf(fid,'M_.Sigma_e = diag(tmp);') fprintf(fid,['stream=RandStream(''mt19937ar'',''Seed'',' int2str(slave_number) ');\n']); -if matlab_ver_less_than('7.12') - fprintf(fid,['RandStream.setDefaultStream(stream);\n\n']); -else - fprintf(fid,['RandStream.setGlobalStream(stream);\n\n']); -end +fprintf(fid,['RandStream.setGlobalStream(stream);\n\n']); fprintf(fid,['maxNumCompThreads(' int2str(threads_per_job) ');\n\n']); @@ -299,4 +295,4 @@ if ((job_number>1) && strcmpi(hostname,remotename)) || ~strcmpi(hostname,remoten fprintf(fid,'exit'); end -fclose(fid); \ No newline at end of file +fclose(fid); diff --git a/matlab/smm_objective.m b/matlab/smm_objective.m index 9ff0e338a..c355ec419 100644 --- a/matlab/smm_objective.m +++ b/matlab/smm_objective.m @@ -15,7 +15,7 @@ function [r,flag] = smm_objective(xparams,sample_moments,weighting_matrix,option % SPECIAL REQUIREMENTS % The user has to provide a file where the moment conditions are defined. -% Copyright (C) 2010-2019 Dynare Team +% Copyright (C) 2010-2020 Dynare Team % % This file is part of Dynare. % @@ -40,11 +40,7 @@ flag = 1; if nargin<5 if isempty(mainStream) - if matlab_ver_less_than('7.12') - mainStream = RandStream.getDefaultStream; - else - mainStream = RandStream.getGlobalStream; - end + mainStream = RandStream.getGlobalStream; mainState = mainStream.State; else mainStream.State = mainState; @@ -156,4 +152,4 @@ if (options.optimization_routine>0) && exist('optimization_path.mat') new_state = [ r; xparams]; estimated_parameters_optimization_path = [ estimated_parameters_optimization_path , new_state ]; save('optimization_path.mat','estimated_parameters_optimization_path'); -end \ No newline at end of file +end diff --git a/matlab/user_has_matlab_license.m b/matlab/user_has_matlab_license.m index 6f8b3c226..de5475ae0 100644 --- a/matlab/user_has_matlab_license.m +++ b/matlab/user_has_matlab_license.m @@ -11,7 +11,7 @@ function [hasLicense] = user_has_matlab_license(toolbox) % SPECIAL REQUIREMENTS % none -% Copyright (C) 2012-2017 Dynare Team +% Copyright (C) 2012-2020 Dynare Team % % This file is part of Dynare. % @@ -28,11 +28,8 @@ function [hasLicense] = user_has_matlab_license(toolbox) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see . -if matlab_ver_less_than('7.12') - hasLicense = license('test', toolbox); -else - [hasLicense, ~] = license('checkout',toolbox); -end +[hasLicense, ~] = license('checkout',toolbox); + if ~hasLicense return end @@ -68,4 +65,4 @@ else hasInstallation=1; end end -end \ No newline at end of file +end diff --git a/matlab/utilities/tests b/matlab/utilities/tests index 371f3f0e6..bc4df1c1e 160000 --- a/matlab/utilities/tests +++ b/matlab/utilities/tests @@ -1 +1 @@ -Subproject commit 371f3f0e6ec209b4277a2fd7911ccf80570d7473 +Subproject commit bc4df1c1ec89a338424b5eb617fa568a76f14b45 diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac index bff1456e8..79115300b 100644 --- a/mex/build/matlab/configure.ac +++ b/mex/build/matlab/configure.ac @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -dnl Copyright © 2009-2019 Dynare Team +dnl Copyright © 2009-2020 Dynare Team dnl dnl This file is part of Dynare. dnl @@ -35,7 +35,7 @@ if test "$ax_enable_matlab" != yes -o "$ax_matlab_version_ok" != yes -o "$ax_mex AC_MSG_ERROR([MATLAB cannot be found]) fi -AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.9], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.9 (R2009b) at least (or disable MATLAB support with --disable-matlab).])]) +AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [8.3], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 8.3 (R2014a) at least (or disable MATLAB support with --disable-matlab).])]) case ${host_os} in *cygwin*) diff --git a/mex/sources/dynblas.h b/mex/sources/dynblas.h index 384b2e26f..8215dd2ad 100644 --- a/mex/sources/dynblas.h +++ b/mex/sources/dynblas.h @@ -8,7 +8,7 @@ * and MATLAB_VERSION (for version 7.4, define it to 0x0704). * * - * Copyright © 2009-2013 Dynare Team + * Copyright © 2009-2020 Dynare Team * * This file is part of Dynare. * @@ -29,8 +29,7 @@ #ifndef _DYNBLAS_H #define _DYNBLAS_H -/* Starting from version 7.8, MATLAB BLAS expects ptrdiff_t arguments for integers */ -#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION >= 0x0708 +#if defined(MATLAB_MEX_FILE) # ifdef __cplusplus # include # else diff --git a/mex/sources/dynlapack.h b/mex/sources/dynlapack.h index 7e953e863..c824570a7 100644 --- a/mex/sources/dynlapack.h +++ b/mex/sources/dynlapack.h @@ -8,7 +8,7 @@ * and MATLAB_VERSION (for version 7.4, define it to 0x0704). * * - * Copyright © 2009-2011 Dynare Team + * Copyright © 2009-2020 Dynare Team * * This file is part of Dynare. * @@ -29,8 +29,7 @@ #ifndef _DYNLAPACK_H #define _DYNLAPACK_H -/* Starting from version 7.8, MATLAB LAPACK expects ptrdiff_t arguments for integers */ -#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION >= 0x0708 +#if defined(MATLAB_MEX_FILE) # ifdef __cplusplus # include # else diff --git a/mex/sources/mjdgges/mjdgges.F08 b/mex/sources/mjdgges/mjdgges.F08 index 5209c01d1..43996e503 100644 --- a/mex/sources/mjdgges/mjdgges.F08 +++ b/mex/sources/mjdgges/mjdgges.F08 @@ -55,10 +55,6 @@ subroutine mexFunction(nlhs, plhs, nrhs, prhs) bind(c, name='mexFunction') #else real(real64), dimension(:), pointer :: gev_r, gev_i #endif -#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION < 0x0904 - ! Workaround for MKL bug, see below - real(real64), dimension(:), allocatable, target :: vsl_target -#endif if (nrhs < 2 .or. nrhs > 4 .or. nlhs /= 6) then call mexErrMsgTxt("MJDGGES: takes 2, 3 or 4 input arguments and exactly 6 output arguments.") @@ -113,19 +109,7 @@ subroutine mexFunction(nlhs, plhs, nrhs, prhs) bind(c, name='mexFunction') #endif info => mxGetPr(plhs(6)) z => mxGetPr(plhs(3)) -#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION < 0x0904 - ! The left Schur vectors (VSL) are normally not computed, since JOBVSL="N". - ! But old MKL versions (at least the one shipped with MATLAB R2009b/7.9, - ! which is MKL 10.1) are buggy, and passing nullptr for VSL leads to a crash. - ! Hence we need to allocate space for it. - ! The bug seems to be fixed in MATLAB R2010a/7.10 (MKL 10.2), but we use the - ! workaround for all versions < R2018a/9.4, since those share the same - ! ABI and hence the same executables. - allocate(vsl_target(n1*n1)) - vsl => vsl_target -#else vsl => null() -#endif ! Copy input matrices, since we can’t modify them associate (a => mxGetPr(prhs(1)), b => mxGetPr(prhs(2))) diff --git a/tests/Makefile.am b/tests/Makefile.am index 14baa19a1..39caeb54d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -832,7 +832,6 @@ EXTRA_DIST = \ block_bytecode/run_ls2003.m \ bvar_a_la_sims/bvar_sample.m \ dates/fsdat_simul.m \ - dates/data_uav.xls \ dates/data_uav.xlsx \ external_function/extFunDeriv.m \ external_function/extFunNoDerivs.m \ @@ -842,7 +841,6 @@ EXTRA_DIST = \ expectations/expectation_ss_old_steadystate.m \ filter_step_ahead/trend_cycle_decomposition_data.m \ steady_state/walsh1_old_ss_steadystate.m \ - data/test.xls \ data/test.xlsx \ gsa/morris/nk_est_data.m \ gsa/data_ca1.m \ @@ -877,7 +875,6 @@ EXTRA_DIST = \ ms-sbvar/archive-files/specification_2v2c.dat \ recursive/data_ca1.m \ recursive/data_ca1_csv.csv \ - recursive/data_ca1_xls.xls \ recursive/data_ca1_xls.xlsx \ kalman_filter_smoother/fsdat_simul.m \ kalman/lik_init/fs2000_common.inc \ diff --git a/tests/analytic_derivatives/BrockMirman_PertParamsDerivs.mod b/tests/analytic_derivatives/BrockMirman_PertParamsDerivs.mod index e2b407c49..4d2809c67 100644 --- a/tests/analytic_derivatives/BrockMirman_PertParamsDerivs.mod +++ b/tests/analytic_derivatives/BrockMirman_PertParamsDerivs.mod @@ -125,10 +125,6 @@ end; calib_params = M_.params; calib_Sigma_e = M_.Sigma_e; -/* Skip test under MATLAB R2009b - MATLAB crashes, most likely due to an internal bug */ -if isoctave || ~matlab_ver_less_than('7.10') - stoch_simul(order=@{ORDER},nograph,irf=0,periods=0); identification(order=@{ORDER},nograph,no_identification_strength); @@ -475,5 +471,3 @@ for jj = 1:2 end end end - -end % Skip test under old MATLAB diff --git a/tests/bgp/nk-1/nk.mod b/tests/bgp/nk-1/nk.mod index aa0c3721a..22e877532 100644 --- a/tests/bgp/nk-1/nk.mod +++ b/tests/bgp/nk-1/nk.mod @@ -21,7 +21,7 @@ end; verbatim; bgp.write(M_); - if isoctave || matlab_ver_less_than('8.1') + if isoctave options = optimset('Display', 'iter', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-8,'TolX',1e-8); else options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8); diff --git a/tests/bgp/ramsey-1/ramsey.mod b/tests/bgp/ramsey-1/ramsey.mod index 54e71e583..0a66aa14f 100644 --- a/tests/bgp/ramsey-1/ramsey.mod +++ b/tests/bgp/ramsey-1/ramsey.mod @@ -16,7 +16,7 @@ end; verbatim; bgp.write(M_); - if isoctave || matlab_ver_less_than('8.1') + if isoctave options = optimset('Display', 'iter', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-6,'TolX',1e-6); else options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-6,'StepTolerance',1e-6); diff --git a/tests/bgp/solow-1/solow.mod b/tests/bgp/solow-1/solow.mod index 7ef45993f..e4d9fa8be 100644 --- a/tests/bgp/solow-1/solow.mod +++ b/tests/bgp/solow-1/solow.mod @@ -45,7 +45,7 @@ verbatim; GY = NaN(MC,1); GK = NaN(MC,1); EG = NaN(MC,1); - if isoctave || matlab_ver_less_than('8.1') + if isoctave options = optimset('Display', 'off', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-8,'TolX',1e-8); else options = optimoptions('fsolve','Display','off','Algorithm','levenberg-marquardt','MaxFunctionEvaluations',1000000,'MaxIterations',100000,'SpecifyObjectiveGradient',true,'FunctionTolerance',1e-8,'StepTolerance',1e-8); diff --git a/tests/conditional_variance_decomposition/example1.mod b/tests/conditional_variance_decomposition/example1.mod index e53ea5382..039fa99ab 100644 --- a/tests/conditional_variance_decomposition/example1.mod +++ b/tests/conditional_variance_decomposition/example1.mod @@ -76,7 +76,7 @@ for i=1:nvar SubsetOfVariables(i) = i_tmp; end -if isoctave || matlab_ver_less_than('8.1') +if isoctave [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'); @@ -114,7 +114,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 || matlab_ver_less_than('8.1') +if isoctave [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'); diff --git a/tests/data/mod1a.mod b/tests/data/mod1a.mod index f475bc52c..a2f0ff951 100644 --- a/tests/data/mod1a.mod +++ b/tests/data/mod1a.mod @@ -20,8 +20,4 @@ end; varobs dx dy; check; -if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a estimation(datafile='test.xlsx',nobs=1000,mh_replic=2000,mh_jscale=1.3); -else -estimation(datafile='test.xls',nobs=1000,mh_replic=2000,mh_jscale=1.3); -end diff --git a/tests/data/test.xls b/tests/data/test.xls deleted file mode 100644 index 0855a60d6..000000000 Binary files a/tests/data/test.xls and /dev/null differ diff --git a/tests/dates/data_uav.xls b/tests/dates/data_uav.xls deleted file mode 100644 index d35bdc3ba..000000000 Binary files a/tests/dates/data_uav.xls and /dev/null differ diff --git a/tests/dates/dseries_interact.mod b/tests/dates/dseries_interact.mod index 50cc5b51d..929b1b489 100644 --- a/tests/dates/dseries_interact.mod +++ b/tests/dates/dseries_interact.mod @@ -41,17 +41,9 @@ varobs log_nn; %reading Excel sheet from column A on creates quarterly dseries starting in %1950 -if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a estimation(first_obs=2,datafile='data_uav.xlsx', xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ; -else -estimation(first_obs=2,datafile='data_uav.xls', xls_sheet=Tabelle1, xls_range=a1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ; -end shock_decomposition( parameter_set=posterior_median ) nn hh; %reading Excel sheet from column B on creates annual dseries starting with 1 -if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a estimation(first_obs=2,datafile='data_uav.xlsx', xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ; -else -estimation(first_obs=2,datafile='data_uav.xls', xls_sheet=Tabelle1, xls_range=b1:b54, mh_replic=2, mh_nblocks=1, mh_jscale=1.1, mh_drop=0.8, plot_priors=0, smoother) log_nn nn hh ; -end shock_decomposition( parameter_set=posterior_median ) nn hh; diff --git a/tests/identification/LindeTrabandt/LindeTrabandt2019_xfail.mod b/tests/identification/LindeTrabandt/LindeTrabandt2019_xfail.mod index 9494da438..1dcf57b2d 100644 --- a/tests/identification/LindeTrabandt/LindeTrabandt2019_xfail.mod +++ b/tests/identification/LindeTrabandt/LindeTrabandt2019_xfail.mod @@ -370,10 +370,6 @@ steady; resid; check; -/* Skip test under MATLAB R2009b - MATLAB crashes, most likely due to an internal bug */ -if isoctave || ~matlab_ver_less_than('7.10') - identification(order=1,no_identification_strength,analytic_derivation_mode= 0,ar=5); %works %identification(no_identification_strength,analytic_derivation_mode= 1,ar=5); %works, this takes the longest due to Kronecker products options_.dynatol.x = 1e-9; @@ -382,7 +378,3 @@ identification(order=1,no_identification_strength,analytic_derivation_mode=-2,ar options_.dynatol.x = 1e-5; %this is the default value identification(order=1,no_identification_strength,analytic_derivation_mode=-1,ar=5); %works only if GBAR_o_YBAR is uncommented identification(order=1,no_identification_strength,analytic_derivation_mode=-2,ar=5); %works only if GBAR_o_YBAR is uncommented - -else % Skip test under old MATLAB - error('Test failed as expected') -end diff --git a/tests/identification/kim/kim2.mod b/tests/identification/kim/kim2.mod index 48697badd..6322b8da4 100644 --- a/tests/identification/kim/kim2.mod +++ b/tests/identification/kim/kim2.mod @@ -81,10 +81,6 @@ end; varobs c i; -/* Skip test under MATLAB R2009b - MATLAB crashes, most likely due to an internal bug */ -if isoctave || ~matlab_ver_less_than('7.10') - identification(advanced=1,max_dim_cova_group=3); //varobs c i lam; //to check if observing lam identifies phi and theta //identification(ar=1,advanced=1,max_dim_cova_group=3,prior_mc=250); @@ -93,5 +89,3 @@ identification(advanced=1,max_dim_cova_group=3); estim_params_=[]; identification(advanced=1,max_dim_cova_group=3); - -end diff --git a/tests/optimizers/fs2000_3.mod b/tests/optimizers/fs2000_3.mod index 09d2c59a5..5efc98d2a 100644 --- a/tests/optimizers/fs2000_3.mod +++ b/tests/optimizers/fs2000_3.mod @@ -1,7 +1,5 @@ @#include "fs2000.common.inc" -% Skip the test under R2009b, because fminunc fails due to Inf value. -% It remains to be determined in which version it started to work. -if exist('fminunc','file') && (isoctave || ~matlab_ver_less_than('7.10')) +if exist('fminunc','file') estimation(mode_compute=3,order=1, datafile='../fs2000/fsdat_simul', nobs=192, mh_replic=0); end diff --git a/tests/recursive/data_ca1_xls.xls b/tests/recursive/data_ca1_xls.xls deleted file mode 100644 index 062baaeaa..000000000 Binary files a/tests/recursive/data_ca1_xls.xls and /dev/null differ diff --git a/tests/recursive/ls2003_bayesian_xls.mod b/tests/recursive/ls2003_bayesian_xls.mod index 0fb926123..c2795e475 100644 --- a/tests/recursive/ls2003_bayesian_xls.mod +++ b/tests/recursive/ls2003_bayesian_xls.mod @@ -61,8 +61,4 @@ stderr e_ys,inv_gamma_pdf,1.2533,0.6551; stderr e_pies,inv_gamma_pdf,1.88,0.9827; end; -if isoctave || ~matlab_ver_less_than('7.14') % xlsread is able to read XLSX without Excel installed since R2012a estimation(datafile='data_ca1_xls.xlsx',first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de; -else -estimation(datafile='data_ca1_xls.xls',first_obs=8,nobs=[76 79],mh_nblocks=1,prefilter=1,mh_jscale=0.5,mh_replic=2000,forecast=8) y_obs R_obs pie_obs dq de; -end diff --git a/tests/run_all_unitary_tests.m b/tests/run_all_unitary_tests.m index a2d21ba65..e9722569f 100644 --- a/tests/run_all_unitary_tests.m +++ b/tests/run_all_unitary_tests.m @@ -39,7 +39,7 @@ if isoctave end % Set random seed, for reproducibility -if isoctave || matlab_ver_less_than('7.12') +if isoctave randn('state',1); rand('state',1); else diff --git a/windows/README.txt b/windows/README.txt index f7608c602..af24e921b 100644 --- a/windows/README.txt +++ b/windows/README.txt @@ -21,7 +21,7 @@ Note: Dynare comes with an automated uninstaller, which you can run from the Using Dynare with MATLAB® ───────────────────────── -Dynare requires MATLAB® version 7.9 (R2009b) or above. With older versions of +Dynare requires MATLAB® version 8.3 (R2014a) or above. With older versions of MATLAB®, it may fail or give unexpected results. To use Dynare, you just have to add the ‘matlab’ subdirectory of your Dynare diff --git a/windows/build.sh b/windows/build.sh index b402d1c2d..a4f39ce00 100755 --- a/windows/build.sh +++ b/windows/build.sh @@ -108,7 +108,7 @@ cp dynare++/src/dynare++.exe dynare++/32-bit/ ## Note that we do out-of-tree compilation, since we want to do these in ## parallel -# Create Windows 32-bit DLL binaries for MATLAB ≥ R2009b +# Create Windows 32-bit DLL binaries for MATLAB ≥ R2014a build_windows_matlab_mex_32 () { mkdir -p "$TMP_DIRECTORY"/matlab-win32/ @@ -118,18 +118,18 @@ build_windows_matlab_mex_32 () --with-gsl="$LIB32_MSYS2" \ --with-matio="$LIB32_MSYS2" \ --with-slicot="$LIB32"/Slicot/without-underscore \ - --with-matlab="$ROOT_DIRECTORY"/deps/matlab32/R2009b \ - MATLAB_VERSION=R2009b \ + --with-matlab="$ROOT_DIRECTORY"/deps/matlab32/R2014a \ + MATLAB_VERSION=R2014a \ MEXEXT=mexw32 \ PACKAGE_VERSION="$VERSION" \ PACKAGE_STRING="dynare $VERSION" make -j"$NTHREADS" all i686-w64-mingw32-strip -- **/*.mexw32 - mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win32-7.9-8.6 - mv -- **/*.mexw32 "$ROOT_DIRECTORY"/../mex/matlab/win32-7.9-8.6 + mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win32-8.3-8.6 + mv -- **/*.mexw32 "$ROOT_DIRECTORY"/../mex/matlab/win32-8.3-8.6 } -# Create Windows 64-bit DLL binaries for MATLAB ≥ R2009b and ≤ R2017b +# Create Windows 64-bit DLL binaries for MATLAB ≥ R2014a and ≤ R2017b build_windows_matlab_mex_64_a () { mkdir -p "$TMP_DIRECTORY"/matlab-win64-a/ @@ -139,15 +139,15 @@ build_windows_matlab_mex_64_a () --with-gsl="$LIB64_MSYS2" \ --with-matio="$LIB64_MSYS2" \ --with-slicot="$LIB64"/Slicot/without-underscore \ - --with-matlab="$ROOT_DIRECTORY"/deps/matlab64/R2009b \ - MATLAB_VERSION=R2009b \ + --with-matlab="$ROOT_DIRECTORY"/deps/matlab64/R2014a \ + MATLAB_VERSION=R2014a \ MEXEXT=mexw64 \ PACKAGE_VERSION="$VERSION" \ PACKAGE_STRING="dynare $VERSION" make -j"$NTHREADS" all x86_64-w64-mingw32-strip -- **/*.mexw64 - mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-7.9-9.3 - mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-7.9-9.3 + mkdir -p "$ROOT_DIRECTORY"/../mex/matlab/win64-8.3-9.3 + mv -- **/*.mexw64 "$ROOT_DIRECTORY"/../mex/matlab/win64-8.3-9.3 } # Create Windows 64-bit DLL binaries for MATLAB ≥ R2018a diff --git a/windows/deps/Makefile b/windows/deps/Makefile index e51b9b9fb..82c3968d9 100644 --- a/windows/deps/Makefile +++ b/windows/deps/Makefile @@ -1,4 +1,4 @@ -# Copyright © 2017-2019 Dynare Team +# Copyright © 2017-2020 Dynare Team # # This file is part of Dynare. # @@ -195,13 +195,13 @@ tarballs/matlab%.tar.xz: matlab32: tarballs/matlab32-$(MATLAB32_VERSION).tar.xz rm -rf $@ mkdir -p $@ - tar xf $< --directory $@ --strip-components=1 + tar xf $< --directory $@ touch $@ matlab64: tarballs/matlab64-$(MATLAB64_VERSION).tar.xz rm -rf $@ mkdir -p $@ - tar xf $< --directory $@ --strip-components=1 + tar xf $< --directory $@ touch $@ matlab: matlab32 matlab64 diff --git a/windows/deps/versions.mk b/windows/deps/versions.mk index 811ee558f..514d209a6 100644 --- a/windows/deps/versions.mk +++ b/windows/deps/versions.mk @@ -5,8 +5,8 @@ OCTAVE_VERSION = 5.2.0 OCTAVE_W32_BUILD = _1 OCTAVE_W64_BUILD = _1 -MATLAB32_VERSION = 20181204 -MATLAB64_VERSION = 20181204 +MATLAB32_VERSION = 20200407 +MATLAB64_VERSION = 20200407 ### MSYS2 packages diff --git a/windows/dynare.nsi b/windows/dynare.nsi index 04a4278b6..8e8bea563 100644 --- a/windows/dynare.nsi +++ b/windows/dynare.nsi @@ -91,9 +91,9 @@ SectionEnd SectionGroup "Dynare support for 64-bit MATLAB and Octave" -Section "MEX files for MATLAB 64-bit, version 7.9 to 9.3 (R2009b to R2017b)" - SetOutPath $INSTDIR\mex\matlab\win64-7.9-9.3 - File ..\mex\matlab\win64-7.9-9.3\*.mexw64 +Section "MEX files for MATLAB 64-bit, version 8.3 to 9.3 (R2014a to R2017b)" + SetOutPath $INSTDIR\mex\matlab\win64-8.3-9.3 + File ..\mex\matlab\win64-8.3-9.3\*.mexw64 SectionEnd Section "MEX files for MATLAB 64-bit, version 9.4 to 9.8 (R2018a to R2020a)" @@ -116,9 +116,9 @@ SectionGroupEnd SectionGroup "Dynare support for 32-bit MATLAB and Octave" -Section "MEX files for MATLAB 32-bit, version 7.9 to 8.6 (R2009b to R2015b)" - SetOutPath $INSTDIR\mex\matlab\win32-7.9-8.6 - File ..\mex\matlab\win32-7.9-8.6\*.mexw32 +Section "MEX files for MATLAB 32-bit, version 8.3 to 8.6 (R2014a to R2015b)" + SetOutPath $INSTDIR\mex\matlab\win32-8.3-8.6 + File ..\mex\matlab\win32-8.3-8.6\*.mexw32 SectionEnd Section "MEX files for Octave 5.2.0 (32-bit)"