diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3e8cad8d9e8dfebaca0f083908db861d96f84850..2e679e713f085d70ee6d931ff06246be63270566 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,7 @@ variables: GIT_SUBMODULE_STRATEGY: recursive TERM: linux MATLAB_VERSION: R2023b - OLD_MATLAB_VERSION: R2014a + OLD_MATLAB_VERSION: R2018b # 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 e4bccbb0e23bd077c8f922dd45b970329baf1056..7c0bcf5f6c87e334a299fa1d7641a00a8d43500f 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -14,7 +14,7 @@ compilation steps are necessary in that case. In order to run Dynare, you need one of the following: -* MATLAB, any version ranging from 8.3 (R2014a) to 23.2 (R2023b); +* MATLAB, any version ranging from 9.5 (R2018b) to 23.2 (R2023b); * GNU Octave, any version ranging from 6.2.0 to 8.4.0, with the statistics package from `Octave-Forge`_. Note however that the Dynare installer for Windows requires a more specific version of Octave, as indicated on the download diff --git a/macOS/build.sh b/macOS/build.sh index 845be1085375fa5ce4bb08e3ef8104d86b86b8ea..e94d70d2f76fbbf02fb4cff10a2e52bc2da4c51f 100755 --- a/macOS/build.sh +++ b/macOS/build.sh @@ -37,8 +37,6 @@ else # Remove /opt/homebrew/bin from PATH, so it does not intervene with the x86_64 compilations path_remove PATH /opt/homebrew/bin MATLAB_ARCH=maci64 - # On x86_64 we need to differentiate between older and newer MATLAB versions - OLD_MATLAB_PATH=/Applications/"$PKG_ARCH"/MATLAB_R2016b.app fi MATLAB_PATH=/Applications/"$PKG_ARCH"/MATLAB_R2023b.app @@ -71,16 +69,10 @@ common_meson_opts=(-Dbuild_for=matlab -Dbuildtype=release -Dprefer_static=true - -Dc_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" -Dcpp_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" -Dfortran_link_args="[ '-Wl,-ld_classic', '-L$QUADMATH_DIR' ]" \ --native-file scripts/homebrew-native-$PKG_ARCH.ini) -# Build for MATLAB ⩾ R2018a (x86_64) and MATLAB ⩾ R2023b (arm64) +# Build for MATLAB ⩾ R2018b (x86_64) and MATLAB ⩾ R2023b (arm64) arch -"$PKG_ARCH" meson setup "${common_meson_opts[@]}" -Dmatlab_path="$MATLAB_PATH" build-matlab --wipe arch -"$PKG_ARCH" meson compile -v -C build-matlab -if [[ "$PKG_ARCH" == x86_64 ]]; then - # Build for MATLAB < R2018a - arch -"$PKG_ARCH" meson setup "${common_meson_opts[@]}" -Dmatlab_path="$OLD_MATLAB_PATH" build-old-matlab --wipe - arch -"$PKG_ARCH" meson compile -v -C build-old-matlab -fi - # If not in CI, build the docs if [[ -z $CI ]]; then arch -"$PKG_ARCH" meson compile -v -C build-matlab doc @@ -125,8 +117,7 @@ mkdir -p \ "$PKGFILES"/scripts \ "$PKGFILES"/contrib/ms-sbvar/TZcode if [[ "$PKG_ARCH" == x86_64 ]]; then - mkdir -p "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-8.3-9.3 \ - "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-9.4-23.2 + mkdir -p "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-9.5-23.2 else mkdir -p "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-23.2 fi @@ -147,8 +138,7 @@ mkdir -p "$PKGFILES" ln -sf ../../preprocessor/dynare-preprocessor "$PKGFILES"/matlab/preprocessor64/dynare_m if [[ "$PKG_ARCH" == x86_64 ]]; then - cp -L "$ROOTDIR"/build-matlab/*.mex"$MATLAB_ARCH" "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-9.4-23.2 - cp -L "$ROOTDIR"/build-old-matlab/*.mex"$MATLAB_ARCH" "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-8.3-9.3 + cp -L "$ROOTDIR"/build-matlab/*.mex"$MATLAB_ARCH" "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-9.5-23.2 else cp -L "$ROOTDIR"/build-matlab/*.mex"$MATLAB_ARCH" "$PKGFILES"/mex/matlab/"$MATLAB_ARCH"-23.2 fi diff --git a/matlab/+mom/get_data_moments.m b/matlab/+mom/get_data_moments.m index bea84599ef4c15237787147911db62ea6500f0c3..8f05692252b13d3f7ba7f6563a79c26a9d682287 100644 --- a/matlab/+mom/get_data_moments.m +++ b/matlab/+mom/get_data_moments.m @@ -60,11 +60,11 @@ for jm = 1:options_mom_.mom.mom_nbr end end % We replace NaN (due to leads and lags and missing values) with the corresponding mean - if isoctave || matlab_ver_less_than('8.5') + if isoctave dataMoments(jm,1) = nanmean(m_data_tmp); else dataMoments(jm,1) = mean(m_data_tmp,'omitnan'); end m_data_tmp(isnan(m_data_tmp)) = dataMoments(jm,1); m_data(:,jm) = m_data_tmp; -end \ No newline at end of file +end diff --git a/matlab/+mom/run.m b/matlab/+mom/run.m index 30dd4bb0223772650e5b0fa1335f9809b042adaa..3994ffbe91832fec7782800c64d54dae4e335e88 100644 --- a/matlab/+mom/run.m +++ b/matlab/+mom/run.m @@ -172,22 +172,6 @@ options_mom_ = mom.default_option_mom_values(options_mom_, options_, M_.dname, d % ------------------------------------------------------------------------- % workarounds % ------------------------------------------------------------------------- -% The TeX option crashes MATLAB R2014a run with "-nodisplay" option -% (as is done from the testsuite). -% Since we can’t directly test whether "-nodisplay" has been passed, -% we test for the "source_root" environment variable, which is set -% by the testsuite. -% Note that it was not tested whether the crash happens with more -% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased, -% one should make a test before removing this workaround. -if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('source_root')) - warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay') - options_.TeX = false; -end -if isfield(options_mom_, 'TeX') && options_mom_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('source_root')) - warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay') - options_mom_.TeX = false; -end if strcmp(options_mom_.mom.mom_method,'GMM') || strcmp(options_mom_.mom.mom_method,'SMM') % temporary workaround for https://git.dynare.org/Dynare/dseries/-/issues/51 if options_mom_.xls_sheet~=1 diff --git a/matlab/+occbin/mkdatap_anticipated_2constraints_dyn.m b/matlab/+occbin/mkdatap_anticipated_2constraints_dyn.m index d74db4c2116b03c5491d47dc917474f773aec3e4..4b4fdf2f914fb477580262851e725fc6dc2b7583 100644 --- a/matlab/+occbin/mkdatap_anticipated_2constraints_dyn.m +++ b/matlab/+occbin/mkdatap_anticipated_2constraints_dyn.m @@ -98,11 +98,7 @@ if T_max > 0 % check if last binding regime was already stored tmp = 0*binding_indicator; tmp(1:end-T_max+1,:) = binding_indicator(T_max:end,:); - if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b - itmp = find(~any(bsxfun(@minus, dictionary.binding_indicator(1:length(tmp)*2,:), tmp(:)))); - else - itmp = find(~any(dictionary.binding_indicator(1:length(tmp)*2,:)-tmp(:))); - end + itmp = find(~any(dictionary.binding_indicator(1:length(tmp)*2,:)-tmp(:))); if ~isempty(itmp) ireg(T_max) = itmp; else @@ -134,11 +130,7 @@ if T_max > 0 for i = T_max-1:-1:1 tmp = 0*binding_indicator; tmp(1:end-i+1,:) = binding_indicator(i:end,:); - if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b - itmp = find(~any(bsxfun(@minus, dictionary.binding_indicator(1:length(tmp)*2,:), tmp(:)))); - else - itmp = find(~any(dictionary.binding_indicator(1:length(tmp)*2,:)-tmp(:))); - end + itmp = find(~any(dictionary.binding_indicator(1:length(tmp)*2,:)-tmp(:))); if ~isempty(itmp) ireg(i) = itmp; else diff --git a/matlab/+occbin/mkdatap_anticipated_dyn.m b/matlab/+occbin/mkdatap_anticipated_dyn.m index f680851925abe8d53438d5bf5796f23a66bd69ff..62b4743158849e392c8791e9ce509c684c10ba0a 100644 --- a/matlab/+occbin/mkdatap_anticipated_dyn.m +++ b/matlab/+occbin/mkdatap_anticipated_dyn.m @@ -89,11 +89,7 @@ if T_max > 0 tmp = 0*binding_indicator; tmp(1:end-i+1) = binding_indicator(i:end); - if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b - itmp = find(~any(bsxfun(@minus, dictionary.binding_indicator, tmp))); - else - itmp = find(~any(dictionary.binding_indicator-tmp)); - end + itmp = find(~any(dictionary.binding_indicator-tmp)); if ~isempty(itmp) ireg(i) = itmp; else diff --git a/matlab/+occbin/solver.m b/matlab/+occbin/solver.m index 33b26e0289b8f81df16bafdf269427408e851262..3b74f018f321fb6fbb6d019b8ef2eadd07cc80b6 100644 --- a/matlab/+occbin/solver.m +++ b/matlab/+occbin/solver.m @@ -19,7 +19,7 @@ function [dr, out, ss] = solver(M_, options_, dr ,steady_state, exo_steady_state % - R: [n_vars by n_exo by n_shock_period] array of shock response matrices % - C: [n_vars by n_shock_period] array of constants -% Copyright © 2021 Dynare Team +% Copyright © 2021-2023 Dynare Team % % This file is part of Dynare. % @@ -90,15 +90,7 @@ end % add back steady state if ~options_.occbin.simul.piecewise_only - if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b - out.linear = bsxfun(@plus, out.linear, out.ys'); - else - out.linear = out.linear + out.ys'; - end -end -if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b - out.piecewise = bsxfun(@plus, out.piecewise, out.ys'); -else - out.piecewise = out.piecewise + out.ys'; + out.linear = out.linear + out.ys'; end -out.exo_pos = options_.occbin.simul.exo_pos; \ No newline at end of file +out.piecewise = out.piecewise + out.ys'; +out.exo_pos = options_.occbin.simul.exo_pos; diff --git a/matlab/+occbin/write_regimes_to_xls.m b/matlab/+occbin/write_regimes_to_xls.m index 40b7ff816b5fbac962b87c97cc232a5594700096..4766f36a518a9e1f3678aa13d7adb7273ddb8eb0 100644 --- a/matlab/+occbin/write_regimes_to_xls.m +++ b/matlab/+occbin/write_regimes_to_xls.m @@ -7,7 +7,7 @@ function write_regimes_to_xls(occbin_struct,M_,options_) % - M_ [struct] Matlab's structure describing the model % - options_ [struct] Matlab's structure describing the current options -% Copyright © 2021 Dynare Team +% Copyright © 2021-2023 Dynare Team % % This file is part of Dynare. % @@ -62,14 +62,7 @@ else end end -if ~ispc && ~isoctave && matlab_ver_less_than('9.0') - % On GNU/Linux and macOS, with MATLAB < R2016a, “writeable†can’t write Excel files - % (and “xlswrite†can’t either) - warning('This version of MATLAB is too old and cannot create Excel files. The Occbin regimes will rather be written to a CSV file.') - filename=[OutputDirectoryName filesep xls_filename '.csv']; -else - filename=[OutputDirectoryName filesep xls_filename '.xls']; -end +filename=[OutputDirectoryName filesep xls_filename '.xls']; if isfile(filename) delete(filename) @@ -81,10 +74,6 @@ if isoctave error('The io package is required to write XLS files from Octave') end xlswrite(filename, vertcat(Header, xlsmat)); -elseif ~ispc && matlab_ver_less_than('9.0') - % Use a CSV file. See the comment above about filename. - % We don’t use xlswrite because its CSV fallback does not support cell-arrays. - writetable(array2table(xlsmat,'VariableNames',Header), filename); else writetable(array2table(xlsmat,'VariableNames',Header), filename, 'Sheet', 'Regimes'); end diff --git a/matlab/dynare.m b/matlab/dynare.m index c23be0d5e51cb2be6db454528ba807472f77f625..68db17156bdc98c8355ac2d412ea2026361dcbf4 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -87,9 +87,9 @@ if isoctave skipline() end else - if matlab_ver_less_than('8.3') % Should match the test in meson.build + if matlab_ver_less_than('9.5') % Should match the test in meson.build skipline() - 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.'); + warning('This version of Dynare has only been tested on MATLAB 9.5 (R2018b) 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 bc000493579921d19853f5322f7d4d0ca4df0807..696c2e522fbb9f8eae1c494818e5e03673fc6ab8 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -105,19 +105,14 @@ if ~exist('struct2array') p{end+1} = '/missing/struct2array'; end -% isfile is missing in MATLAB < R2017b -if ~isoctave && matlab_ver_less_than('9.3') - p{end+1} = '/missing/isfile'; -end - -% contains and splitlines don't exist in Octave and in MATLAB < R2016b -if isoctave || matlab_ver_less_than('9.1') +% contains and splitlines don't exist in Octave +if isoctave p{end+1} = '/missing/contains'; p{end+1} = '/missing/splitlines'; end -% datetime doesn't exist in Octave and in MATLAB < R2014b -if isoctave || matlab_ver_less_than('8.4') +% datetime doesn't exist in Octave +if isoctave p{end+1} = '/missing/datetime'; end diff --git a/matlab/dynare_estimation.m b/matlab/dynare_estimation.m index ca1e4065b54c6405e2a26341b7c208ba30378223..7797af3dcae50cfa380be89b5ebadaf68970f87b 100644 --- a/matlab/dynare_estimation.m +++ b/matlab/dynare_estimation.m @@ -43,19 +43,6 @@ if ~isempty(strmatch('dsge_prior_weight',M_.param_names)) options_.dsge_var = 1; end -% The TeX option crashes MATLAB R2014a run with "-nodisplay" option -% (as is done from the testsuite). -% Since we can’t directly test whether "-nodisplay" has been passed, -% we test for the "source_root" environment variable, which is set -% by the testsuite. -% Note that it was not tested whether the crash happens with more -% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased, -% one should make a test before removing this workaround. -if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('source_root')) - warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay') - options_.TeX = false; -end - var_list = check_list_of_variables(options_, M_, var_list); options_.varlist = var_list; diff --git a/matlab/dynare_identification.m b/matlab/dynare_identification.m index 6c0e64866d74e64382c30c1011ecfbb302f1a233..edfc8534ce703762e019f99014552f97028944fd 100644 --- a/matlab/dynare_identification.m +++ b/matlab/dynare_identification.m @@ -67,19 +67,6 @@ function [pdraws, STO_REDUCEDFORM, STO_MOMENTS, STO_DYNAMIC, STO_si_dDYNAMIC, ST global M_ options_ oo_ bayestopt_ estim_params_ -% The TeX option crashes MATLAB R2014a run with "-nodisplay" option -% (as is done from the testsuite). -% Since we can’t directly test whether "-nodisplay" has been passed, -% we test for the "source_root" environment variable, which is set -% by the testsuite. -% Note that it was not tested whether the crash happens with more -% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased, -% one should make a test before removing this workaround. -if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('source_root')) - warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay') - options_.TeX = false; -end - store_options_ = options_; % store options to restore them at the end fname = M_.fname; %model name dname = M_.dname; %model name diff --git a/matlab/dynare_solve.m b/matlab/dynare_solve.m index 3368eb96ab52940d31c5c76b8ec872df6c681467..871737faab0dfdeba3c2a6a87c06c6cb7ebea23b 100644 --- a/matlab/dynare_solve.m +++ b/matlab/dynare_solve.m @@ -162,7 +162,7 @@ if options.solve_algo == 0 else options4fsolve = optimoptions('fsolve'); end - if isoctave || matlab_ver_less_than('9.0') % Option names changed in MATLAB R2016a + if isoctave options4fsolve.MaxFunEvals = 50000; options4fsolve.MaxIter = maxit; options4fsolve.TolFun = tolf; diff --git a/matlab/epilogue_shock_decomposition.m b/matlab/epilogue_shock_decomposition.m index 4a76cd2defcf2ac9e832d3225dabfab7dd1d440d..b610c5f35e305079ccbab7560cefed881a2bd13f 100644 --- a/matlab/epilogue_shock_decomposition.m +++ b/matlab/epilogue_shock_decomposition.m @@ -27,11 +27,7 @@ nterms = size(z,2); for k=1:size(y,1) ytmp = squeeze(y(k,:,:)); yres = ytmp(end,:) - sum(ytmp(1:end-1,:)); - if ~isoctave && matlab_ver_less_than('9.1') % Automatic broadcasting was introduced in MATLAB R2016b - w = bsxfun(@rdivide, abs(ytmp(1:end-1,:)), sum(abs(ytmp(1:end-1,:)))) - else - w = abs(ytmp(1:end-1,:))./sum(abs(ytmp(1:end-1,:))); - end + w = abs(ytmp(1:end-1,:))./sum(abs(ytmp(1:end-1,:))); % ytmp(1:end-1,:) = ytmp(1:end-1,:) + repmat(yres,[nterms-1 1])/(nterms-1); ytmp(1:end-1,:) = ytmp(1:end-1,:) + repmat(yres,[nterms-1 1]).*w; y(k,:,:) = ytmp; diff --git a/matlab/get_path_to_mex_files.m b/matlab/get_path_to_mex_files.m index 432d4095aa80e1baad66d46194972999e8421ee8..a583f0d889067110ead9bf1e27928c9c37ba0469 100644 --- a/matlab/get_path_to_mex_files.m +++ b/matlab/get_path_to_mex_files.m @@ -47,30 +47,16 @@ else end % Add win64 specific paths for Dynare Windows package if strcmp(computer, 'PCWIN64') - if matlab_ver_less_than('9.4') - tmp = [dynareroot '../mex/matlab/win64-8.3-9.3/']; - if exist(tmp, 'dir') - mexpath = tmp; - end - else - tmp = [dynareroot '../mex/matlab/win64-9.4-23.2/']; - if exist(tmp, 'dir') - mexpath = tmp; - end + tmp = [dynareroot '../mex/matlab/win64-9.5-23.2/']; + if exist(tmp, 'dir') + mexpath = tmp; end end % Add macOS paths for Dynare Mac package if strcmp(computer, 'MACI64') - if matlab_ver_less_than('9.4') - tmp = [dynareroot '../mex/matlab/maci64-8.3-9.3/']; - if exist(tmp, 'dir') - mexpath = tmp; - end - else - tmp = [dynareroot '../mex/matlab/maci64-9.4-23.2/']; - if exist(tmp, 'dir') - mexpath = tmp; - end + tmp = [dynareroot '../mex/matlab/maci64-9.5-23.2/']; + if exist(tmp, 'dir') + mexpath = tmp; end end if strcmp(computer, 'MACA64') diff --git a/matlab/graph_decomp_detail.m b/matlab/graph_decomp_detail.m index dde4a90dbd123fe4dc7a1e4ca05aa447e99c52c0..37fce139e1f3b2e835042887ac01ef56031b996e 100644 --- a/matlab/graph_decomp_detail.m +++ b/matlab/graph_decomp_detail.m @@ -190,8 +190,8 @@ for j=1:nvar ineg=zz<0; hax = subplot(nrow,ncol,i); set(gca,'box','on') hbar = bar(x(2:end),(zz.*ipos)','stacked','FaceColor','flat'); - if ~isoctave && ~matlab_ver_less_than('9.3.0') - % make bar obey colormap under MATLAB R2017b + if ~isoctave + % make bar obey colormap under MATLAB for k = 1:2 hbar(k).CData = k; end @@ -199,8 +199,8 @@ for j=1:nvar set(hbar,'edgecolor','flat'); hold on, hbar = bar(x(2:end),(zz.*ineg)','stacked','FaceColor','flat'); - if ~isoctave && ~matlab_ver_less_than('9.3.0') - % make bar obey colormap under MATLAB R2017b + if ~isoctave + % make bar obey colormap under MATLAB for k = 1:2 hbar(k).CData = k; end diff --git a/matlab/loadjson_.m b/matlab/loadjson_.m index 9df0a51e32407e6830ed0d4fd803197a23a9ecbf..70c61b28681fe0d22bbaad8bfbbfee16ad2b3255 100644 --- a/matlab/loadjson_.m +++ b/matlab/loadjson_.m @@ -10,9 +10,8 @@ function o = loadjson_(jsonfilename) % % REMARKS % jsondecode builtin was introduced in MATLAB R2016b and in Octave 7. -% Older MATLAB and Octave versions use jsonlab as fallback. -% Copyright © 2020-2022 Dynare Team +% Copyright © 2020-2023 Dynare Team % % This file is part of Dynare. % @@ -29,7 +28,7 @@ function o = loadjson_(jsonfilename) % You should have received a copy of the GNU General Public License % along with Dynare. If not, see <https://www.gnu.org/licenses/>. -if (isoctave && octave_ver_less_than('7')) || (~isoctave && matlab_ver_less_than('9.1')) +if isoctave && octave_ver_less_than('7') o = loadjson(jsonfilename); return end diff --git a/matlab/missing/isfile/isfile.m b/matlab/missing/isfile/isfile.m deleted file mode 100644 index 9fb0af345ecf487a8d15be0de0ac2965c4f2ca57..0000000000000000000000000000000000000000 --- a/matlab/missing/isfile/isfile.m +++ /dev/null @@ -1,88 +0,0 @@ -function a = isfile(b) - -%@info: -%! @deftypefn {Function File} {@var{a} =} isfile (@var{b}) -%! @anchor{isfile} -%! @sp 1 -%! Test if @var{b} is a file. -%! @sp 2 -%! @strong{Inputs} -%! @sp 1 -%! @table @var -%! @item b -%! A matlab/octave string. -%! @end table -%! @sp 2 -%! @strong{Outputs} -%! @sp 1 -%! @table @var -%! @item a -%! Integer scalar, equal to 1 if @var{b} is a file, zero otherwise. -%! @end table -%! @sp 2 -%! @strong{This function is called by:} -%! @sp 2 -%! @strong{This function calls:} -%! @sp 2 -%! @end deftypefn -%@eod: - -% Copyright © 2012-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 <https://www.gnu.org/licenses/>. - -stringarrayflag = false; -cellofstringflag = false; -n = 1; -a = false; - -if ~isoctave() && ~matlab_ver_less_than('9.1') && isstring(b) && length(b)>1 && isvector(b) - n = length(b); - stringarrayflag = true; - a = false(size(b)); -end - -if iscell(b) && length(b)>1 && isvector(b) - if all(cellfun(@ischar, b)) - n = length(b); - cellofstringflag = true; - a = false(size(b)); - else - error('Wrong input argument type!') - end -end - -for i=1:n - if stringarrayflag - d = b(i); - elseif cellofstringflag - d = b{i}; - elseif ischar(b) && size(b, 1)==1 - d = b; - else - error('Wrong input argument type!') - end - [base, ext] = strtok(d, '.'); - if isempty(ext) - % File has no extension. - [status, c] = fileattrib(d); - if status - a(i) = ~c.directory; - end - else - a(i) = isequal(exist(d, 'file'), 2); - end -end \ No newline at end of file diff --git a/matlab/missing/stats/+gamrnd/best_1978.m b/matlab/missing/stats/+gamrnd/best_1978.m index 30b540adfc7e6c2c6694e1947b90f2952a8fd47f..8f0da3a20429fd837d2b955c70826a03a72e0f98 100644 --- a/matlab/missing/stats/+gamrnd/best_1978.m +++ b/matlab/missing/stats/+gamrnd/best_1978.m @@ -9,7 +9,7 @@ function g = best_1978(a ,b) % OUTPUTS % - g [double] n*1 vector, gamma variates. -% Copyright © 2006-2020 Dynare Team +% Copyright © 2006-2023 Dynare Team % % This file is part of Dynare. % @@ -44,12 +44,7 @@ while mm X(index) = bb(index)+Y(index); % x id1 = index(X(index)<0); % Reject. id2 = setdiff(index, id1); - if numel(id2) ~= 0 || isoctave || ~matlab_ver_less_than('9.1') - % If id2=[], LHS of the .* has size [0,0], while RHS is [0,1]. - % Since there is no automatic broadcast in MATLAB < R2016b, skip the - % statement in that case. - Z(id2) = 64.0*(W(id2).^3).*(rand(length(id2),1).^2); % d - end + Z(id2) = 64.0*(W(id2).^3).*(rand(length(id2),1).^2); % d id3 = id2(Z(id2)>1.0-2.0*Y(id2).*Y(id2)./X(id2)); % Reject. id4 = id3(log(Z(id3))>2.0*(bb(id3).*log(X(id3)./bb(id3))-Y(id3))); % Reject. index = [id1, id4]; diff --git a/matlab/missing/stats/+gamrnd/knuth.m b/matlab/missing/stats/+gamrnd/knuth.m index f8ca7ef30f17b158b5958a76e42e894093bba70c..e5ed6c3276f53541438ac769e8d3ed0d16c1c21a 100644 --- a/matlab/missing/stats/+gamrnd/knuth.m +++ b/matlab/missing/stats/+gamrnd/knuth.m @@ -9,7 +9,7 @@ function g = knuth(a, b) % OUTPUTS % - g [double] n*1 vector, gamma variates. -% Copyright © 2006-2020 Dynare Team +% Copyright © 2006-2023 Dynare Team % % This file is part of Dynare. % @@ -38,15 +38,7 @@ while mm X(index) = Y(index).*bb(index) + a(index) - 1; id1 = index(X(index)<=0); % Rejected draws. id2 = setdiff(index, id1); - if numel(id2) == 0 && ~isoctave && matlab_ver_less_than('9.1') - % The LHS of the > comparison in the "else" branch has size = [0, 1] - % while the RHS has size = [0, 0]. - % Automatic broadcasting was only introduced in MATLAB R2016b, so we - % must handle this case separately to avoid an error. - id3 = []; - else - id3 = id2(rand(length(id2), 1)>(1+Y(id2).*Y(id2)).*exp((a(id2)-1).*(log(X(id2))-log(a(id2)-1))-bb(id2).*Y(id2))); % Rejected draws. - end + id3 = id2(rand(length(id2), 1)>(1+Y(id2).*Y(id2)).*exp((a(id2)-1).*(log(X(id2))-log(a(id2)-1))-bb(id2).*Y(id2))); % Rejected draws. index = [id1, id3]; mm = length(index); end diff --git a/matlab/modules/dseries b/matlab/modules/dseries index 3d7817fcd9b929d5e71b2669e59f2268558d136a..99b6f167e71945a45249dbc6b5100d2ca6b1474f 160000 --- a/matlab/modules/dseries +++ b/matlab/modules/dseries @@ -1 +1 @@ -Subproject commit 3d7817fcd9b929d5e71b2669e59f2268558d136a +Subproject commit 99b6f167e71945a45249dbc6b5100d2ca6b1474f diff --git a/matlab/optimization/dynare_minimize_objective.m b/matlab/optimization/dynare_minimize_objective.m index 582b456451db0bf2950c5e03ceffc5794c7d3d9c..93737a85cf7e1422f0b3846c7640b94582452e0b 100644 --- a/matlab/optimization/dynare_minimize_objective.m +++ b/matlab/optimization/dynare_minimize_objective.m @@ -26,7 +26,7 @@ function [opt_par_values,fval,exitflag,hessian_mat,options_,Scale,new_rat_hess_i % none. % % -% Copyright © 2014-2021 Dynare Team +% Copyright © 2014-2023 Dynare Team % % This file is part of Dynare. % @@ -566,7 +566,7 @@ switch minimizer_algorithm optim_options.Display='off'; end if options_.analytic_derivation || (isfield(options_,'mom') && options_.mom.analytic_jacobian==1) - if isoctave || matlab_ver_less_than('9.0') % Option names changed in MATLAB R2016a + if isoctave optim_options.Jacobian = 'on'; else optim_options.SpecifyObjectiveGradient = true; diff --git a/matlab/stoch_simul.m b/matlab/stoch_simul.m index 6803b90404476132e909a6c5a3fafe8d8975fff8..30278fd0c8e6525780caeb78489981c0761ae6be 100644 --- a/matlab/stoch_simul.m +++ b/matlab/stoch_simul.m @@ -36,19 +36,6 @@ if isequal(options_.order,0) error('stoch_simul:: The order of the Taylor approximation cannot be 0!') end -% The TeX option crashes MATLAB R2014a run with "-nodisplay" option -% (as is done from the testsuite). -% Since we can’t directly test whether "-nodisplay" has been passed, -% we test for the "source_root" environment variable, which is set -% by the testsuite. -% Note that it was not tested whether the crash happens with more -% recent MATLAB versions, so when OLD_MATLAB_VERSION is increased, -% one should make a test before removing this workaround. -if options_.TeX && ~isoctave && matlab_ver_less_than('8.4') && ~isempty(getenv('source_root')) - warning('Disabling TeX option due to a bug in MATLAB R2014a with -nodisplay') - options_.TeX = false; -end - if M_.exo_nbr==0 error('stoch_simul:: does not support having no varexo in the model. As a workaround you could define a dummy exogenous variable.') end diff --git a/matlab/surgibbs.m b/matlab/surgibbs.m index 1528efa45f3634a29287dc09d980821bb5e7ae66..994d9169dcb8dd78278ac1f7ff50f5f9a933e686 100644 --- a/matlab/surgibbs.m +++ b/matlab/surgibbs.m @@ -217,8 +217,8 @@ end % Plot % -% The histogram() function is not implemented in Octave and in MATLAB < R2014b -if ~options_.nograph && ~isoctave && ~matlab_ver_less_than('8.4') +% The histogram() function is not implemented in Octave +if ~options_.nograph && ~isoctave figure nrows = 5; ncols = floor(nparams/nrows); diff --git a/matlab/trust_region.m b/matlab/trust_region.m index 3e2396252daa68b7f3abdeec46ae5d7d49a31b0d..9aa8b78c1a3e3f3791b1f274bb2ca79d2cc933d6 100644 --- a/matlab/trust_region.m +++ b/matlab/trust_region.m @@ -36,7 +36,7 @@ function [x, errorflag, info] = trust_region(objfun, x, j1, j2, jacobianflag, gs % 4 if iteration is not making good progress, as measured by the improvement from the last 15 iterations. % 5 if no further improvement in the approximate solution x is possible (xtol is too small). -% Copyright © 2014-2022 Dynare Team +% Copyright © 2014-2023 Dynare Team % % This file is part of Dynare. % @@ -285,8 +285,8 @@ end function x = dogleg (r, b, d, delta) % Compute the Gauss-Newton direction. -if isoctave || matlab_ver_less_than('9.3') - % The decomposition() function does not exist in Octave and MATLAB < R2017b +if isoctave + % The decomposition() function does not exist in Octave x = r \ b; else x = decomposition(r, 'CheckCondition', false) \ b; @@ -332,4 +332,4 @@ else else %prevent zero weight on Inf evaluating to NaN x = min(sgnorm, delta)*s; end -end \ No newline at end of file +end diff --git a/meson.build b/meson.build index b40b178876bbfa5fc9c25b52f1a4033758613822..3a6ac503db425d8483fd3048f30f9fae77578b1b 100644 --- a/meson.build +++ b/meson.build @@ -97,7 +97,7 @@ if get_option('build_for') == 'matlab' error('The “matlab_path†option must be provided when doing a MATLAB build') endif matlab_version = run_command('scripts/get-matlab-version', matlab_path, check : true).stdout().strip() - matlab_minimal_version = [ '8.3', 'R2014a' ] + matlab_minimal_version = [ '9.5', 'R2018b' ] if matlab_version.version_compare('<' + matlab_minimal_version[0]) error('MATLAB is too old (version ' + matlab_version + '), please upgrade to version ' + matlab_minimal_version[0] + ' (' + matlab_minimal_version[1] + ') at least.') diff --git a/mex/sources/defines.F08 b/mex/sources/defines.F08 index 80d607f63a513122fb51c4c8ab93e3596aba19aa..483f714d4622e1933d3b712723f681ce60ca0cdd 100644 --- a/mex/sources/defines.F08 +++ b/mex/sources/defines.F08 @@ -1 +1 @@ -#define MX_HAS_INTERLEAVED_COMPLEX (defined(MATLAB_MEX_FILE) && MATLAB_VERSION >= 0x0904) +#define MX_HAS_INTERLEAVED_COMPLEX (defined(MATLAB_MEX_FILE)) diff --git a/mex/sources/dynmex.h b/mex/sources/dynmex.h index 3fb46aab5ad2f00a96ea07fe2df084bbfcd3c503..c7a8395987af16115e68c2af482763cb3baba81c 100644 --- a/mex/sources/dynmex.h +++ b/mex/sources/dynmex.h @@ -26,24 +26,4 @@ #include <mex.h> -#if defined(MATLAB_MEX_FILE) && MATLAB_VERSION < 0x0805 -# define mxIsScalar(x) (mxGetM(x) == 1 && mxGetN(x) == 1) -#endif - -/* The int64_T and uint64_T type are broken under MinGW for MATLAB < R2015b - (they actually alias long integer types, which are 32-bit) */ -#if defined(MATLAB_MEX_FILE) && defined(__MINGW64__) && MATLAB_VERSION < 0x0806 -# define int64_T long long -# define uint64_T unsigned long long -#endif -/* NB: the following #ifdef can be removed when we upgrade to C23, since the - latter has static_assert as a keyword */ -#ifdef __cplusplus -static_assert(sizeof(int64_T) == 8, "The int64_T type is buggy"); -static_assert(sizeof(uint64_T) == 8, "The uint64_T type is buggy"); -#else -_Static_assert(sizeof(int64_T) == 8, "The int64_T type is buggy"); -_Static_assert(sizeof(uint64_T) == 8, "The uint64_T type is buggy"); -#endif - #endif diff --git a/mex/sources/matlab_mex.F08 b/mex/sources/matlab_mex.F08 index 4109bd2c9df742d0b906548dc512a6c0dafe54aa..3ab246f2f982dd491606b5d41a4873e9efaf8bfc 100644 --- a/mex/sources/matlab_mex.F08 +++ b/mex/sources/matlab_mex.F08 @@ -8,11 +8,11 @@ ! Things to be aware of when adding new interfaces this file: ! ! — The tricky part is to deal with API versioning. -! • API_VER is for functions which were not versioned before 9.4 (R2018a) -! • API_VER2 is for functions which were versioned _730 before 9.4 (R2018a) -! when not using the MX_COMPAT_32 mode +! For MATLAB ⩾ R2018b, all versions share the same API (embodied in API_VER +! define), but in the past the API would differ across function, so there +! was an API_VER2 define for those. ! For each function, the information can be retrieved from either matrix.h or -! mex.h from R2014a +! mex.h. ! — C passes arguments by value, so the “value†keyword is often needed ! — Strings passed to C must be null terminated (hence a wrapper is needed to ! append c_null_char) @@ -49,17 +49,10 @@ ! along with Dynare. If not, see <https://www.gnu.org/licenses/>. #ifdef MATLAB_MEX_FILE -# if MATLAB_VERSION >= 0x0904 -# define API_VER "_800" -# define API_VER2 "_800" -# else -# define API_VER "" -# define API_VER2 "_730" -# endif +# define API_VER "_800" #else ! Octave # define API_VER "" -# define API_VER2 "" #endif #include "defines.F08" @@ -116,7 +109,7 @@ module matlab_mat !! Create, Query, and Access Data Types ! Numeric types - type(c_ptr) function mxCreateDoubleMatrix(m, n, ComplexFlag) bind(c, name="mxCreateDoubleMatrix"//API_VER2) + type(c_ptr) function mxCreateDoubleMatrix(m, n, ComplexFlag) bind(c, name="mxCreateDoubleMatrix"//API_VER) use iso_c_binding import :: mwSize, mxComplexity integer(mwSize), intent(in), value :: m, n @@ -178,7 +171,7 @@ module matlab_mat #endif ! Sparse - type(c_ptr) function mxCreateSparse(m, n, nzmax, ComplexFlag) bind(c, name="mxCreateSparse"//API_VER2) + type(c_ptr) function mxCreateSparse(m, n, nzmax, ComplexFlag) bind(c, name="mxCreateSparse"//API_VER) use iso_c_binding import :: mwSize, mxComplexity integer(mwSize), intent(in), value :: m, n, nzmax @@ -190,12 +183,12 @@ module matlab_mat type(c_ptr), intent(in), value :: pm end function mxIsSparse - pure type(c_ptr) function mxGetIr(pm) bind(c, name="mxGetIr"//API_VER2) + pure type(c_ptr) function mxGetIr(pm) bind(c, name="mxGetIr"//API_VER) use iso_c_binding type(c_ptr), intent(in), value :: pm end function mxGetIr - pure type(c_ptr) function mxGetJc(pm) bind(c, name="mxGetJc"//API_VER2) + pure type(c_ptr) function mxGetJc(pm) bind(c, name="mxGetJc"//API_VER) use iso_c_binding type(c_ptr), intent(in), value :: pm end function mxGetJc @@ -242,7 +235,7 @@ module matlab_mat end function mxIsClass_internal ! Structure - type(c_ptr) function mxCreateStructMatrix_internal(m, n, nfields, fieldnames) bind(c, name="mxCreateStructMatrix"//API_VER2) + type(c_ptr) function mxCreateStructMatrix_internal(m, n, nfields, fieldnames) bind(c, name="mxCreateStructMatrix"//API_VER) use iso_c_binding import :: mwSize integer(mwSize), intent(in), value :: m, n @@ -255,7 +248,7 @@ module matlab_mat type(c_ptr), intent(in), value :: pm end function mxIsStruct - pure type(c_ptr) function mxGetField_internal(pm, index, fieldname) bind(c, name="mxGetField"//API_VER2) + pure type(c_ptr) function mxGetField_internal(pm, index, fieldname) bind(c, name="mxGetField"//API_VER) use iso_c_binding import :: mwIndex type(c_ptr), intent(in), value :: pm @@ -263,7 +256,7 @@ module matlab_mat character(c_char), dimension(*), intent(in) :: fieldname end function mxGetField_internal - subroutine mxSetField_internal(pm, index, fieldname, pvalue) bind(c, name="mxSetField"//API_VER2) + subroutine mxSetField_internal(pm, index, fieldname, pvalue) bind(c, name="mxSetField"//API_VER) use iso_c_binding import :: mwIndex type(c_ptr), intent(in), value :: pm @@ -283,7 +276,7 @@ module matlab_mat type(c_ptr), intent(in), value :: pm end function mxIsCell - pure type(c_ptr) function mxGetCell_internal(pm, index) bind(c, name="mxGetCell"//API_VER2) + pure type(c_ptr) function mxGetCell_internal(pm, index) bind(c, name="mxGetCell"//API_VER) use iso_c_binding import :: mwIndex type(c_ptr), intent(in), value :: pm diff --git a/preprocessor b/preprocessor index c4c14963a1d66009fcf04fbc63fdffff4384d9fd..73be95423d3f8c1aa05a5edae2712ffbf646602a 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit c4c14963a1d66009fcf04fbc63fdffff4384d9fd +Subproject commit 73be95423d3f8c1aa05a5edae2712ffbf646602a diff --git a/tests/bgp/fs2000/fs2000.mod b/tests/bgp/fs2000/fs2000.mod index 8ad2950925000704c3228f8fc2858e76230d4ed5..d26177b3c001d019f0ab1cf7934646f2b01bcff1 100644 --- a/tests/bgp/fs2000/fs2000.mod +++ b/tests/bgp/fs2000/fs2000.mod @@ -7,7 +7,7 @@ */ /* - * Copyright © 2019-2021 Dynare Team + * Copyright © 2019-2023 Dynare Team * * This file is part of Dynare. * @@ -66,9 +66,6 @@ verbatim; g = ones(M_.endo_nbr,1);% 1+(rand(M_.endo_nbr,1)-.5)*.1; if isoctave options = optimset('Display','iter','Algorithm','levenberg-marquardt','MaxFunEvals',1000000,'MaxIter',100000,'GradObj','on','TolFun',1e-6,'TolX',1e-6); - elseif matlab_ver_less_than('9.0') - % See https://fr.mathworks.com/help/optim/ug/current-and-legacy-option-name-tables.html - options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','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); end diff --git a/tests/bgp/nk-1/nk.mod b/tests/bgp/nk-1/nk.mod index 32f8ec25fe860da5c898fb50e4fb6cc088da561f..d8b4aca2734e37893c9483a3ea5ba459941e226e 100644 --- a/tests/bgp/nk-1/nk.mod +++ b/tests/bgp/nk-1/nk.mod @@ -23,9 +23,6 @@ verbatim; bgp.write(M_); if isoctave options = optimset('Display', 'iter', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-8,'TolX',1e-8); - elseif matlab_ver_less_than('9.0') - % See https://fr.mathworks.com/help/optim/ug/current-and-legacy-option-name-tables.html - options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','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); end diff --git a/tests/bgp/ramsey-1/ramsey.mod b/tests/bgp/ramsey-1/ramsey.mod index 62a0d015585b4ac316cc2c36a8ac78762489c2a1..26227db4c325eed8528629667bf84e13f7b9c4c7 100644 --- a/tests/bgp/ramsey-1/ramsey.mod +++ b/tests/bgp/ramsey-1/ramsey.mod @@ -18,9 +18,6 @@ verbatim; bgp.write(M_); if isoctave options = optimset('Display', 'iter', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-7,'TolX',1e-7); - elseif matlab_ver_less_than('9.0') - % See https://fr.mathworks.com/help/optim/ug/current-and-legacy-option-name-tables.html - options = optimoptions('fsolve','Display','iter','Algorithm','levenberg-marquardt','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); end diff --git a/tests/bgp/solow-1/solow.mod b/tests/bgp/solow-1/solow.mod index 930c6d0d7ff262a978f698e54a767f00963c03d3..c96abdcdec0798bfd40f5971365b6ffb8b348db5 100644 --- a/tests/bgp/solow-1/solow.mod +++ b/tests/bgp/solow-1/solow.mod @@ -49,9 +49,6 @@ verbatim; EG = NaN(MC,1); if isoctave options = optimset('Display', 'off', 'MaxFunEvals', 1000000,'MaxIter',100000,'Jacobian','on','TolFun',1e-8,'TolX',1e-8); - elseif matlab_ver_less_than('9.0') - % See https://fr.mathworks.com/help/optim/ug/current-and-legacy-option-name-tables.html - options = optimoptions('fsolve','Display','off','Algorithm','levenberg-marquardt','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); end diff --git a/tests/estimation/method_of_moments/AFVRR/AFVRR_M0.mod b/tests/estimation/method_of_moments/AFVRR/AFVRR_M0.mod index 88bb95a00661159c8af72aabac60db710c222f1a..62b1edc511b5f4a901dd18c5c8f24ab02638854a 100644 --- a/tests/estimation/method_of_moments/AFVRR/AFVRR_M0.mod +++ b/tests/estimation/method_of_moments/AFVRR/AFVRR_M0.mod @@ -2,7 +2,7 @@ % Andreasen, Fernandez-Villaverde, Rubio-Ramirez (2018), The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications, Review of Economic Studies, 85, p. 1-49 % Adapted for Dynare by Willi Mutschler (@wmutschl, willi@mutschler.eu), Jan 2021 % ========================================================================= -% Copyright © 2021 Dynare Team +% Copyright © 2021-2023 Dynare Team % % This file is part of Dynare. % @@ -257,8 +257,7 @@ dev_datamoments = str2double(AndreasenEtAl.moments@{orderApp}(:,5)) - oo_.mom.d dev_modelmoments = str2double(AndreasenEtAl.moments@{orderApp}(:,6)) - oo_.mom.model_moments; % There is no table command in Octave -% The table command also crashes on MATLAB R2014a because it does not like variable names -if ~isoctave && ~matlab_ver_less_than('8.4') +if ~isoctave table([AndreasenEtAl.Q@{orderApp} ; str2double(AndreasenEtAl.moments@{orderApp}(:,5)) ; str2double(AndreasenEtAl.moments@{orderApp}(:,6))],... [oo_.mom.Q ; oo_.mom.data_moments ; oo_.mom.model_moments ],... [dev_Q ; dev_datamoments ; dev_modelmoments ],... diff --git a/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB.mod b/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB.mod index 0faacd04a43f153059f69e83ccb88a83c597db3a..f4653c43a9aa2915aabc458a3cbad116c8c4a007 100644 --- a/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB.mod +++ b/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB.mod @@ -2,7 +2,7 @@ % Andreasen, Fernandez-Villaverde, Rubio-Ramirez (2018), The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications, Review of Economic Studies, 85, p. 1-49 % Adapted for Dynare by Willi Mutschler (@wmutschl, willi@mutschler.eu), Jan 2021 % ========================================================================= -% Copyright © 2021 Dynare Team +% Copyright © 2021-2023 Dynare Team % % This file is part of Dynare. % @@ -258,8 +258,7 @@ dev_datamoments = str2double(AndreasenEtAl.moments@{orderApp}(:,5)) - oo_.mom.d dev_modelmoments = str2double(AndreasenEtAl.moments@{orderApp}(:,6)) - oo_.mom.model_moments; % There is no table command in Octave -% The table command also crashes on MATLAB R2014a because it does not like variable names -if ~isoctave && ~matlab_ver_less_than('8.4') +if ~isoctave table([AndreasenEtAl.Q@{orderApp} ; str2double(AndreasenEtAl.moments@{orderApp}(:,5)) ; str2double(AndreasenEtAl.moments@{orderApp}(:,6))],... [oo_.mom.Q ; oo_.mom.data_moments ; oo_.mom.model_moments ],... [dev_Q ; dev_datamoments ; dev_modelmoments ],... diff --git a/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB_RRA.mod b/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB_RRA.mod index e8d0a97a4731cb7aecdebaa94cfb879c213b2fd8..8a511af731489ae55d0048f457470d811fea6d32 100644 --- a/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB_RRA.mod +++ b/tests/estimation/method_of_moments/AFVRR/AFVRR_MFB_RRA.mod @@ -2,7 +2,7 @@ % Andreasen, Fernandez-Villaverde, Rubio-Ramirez (2018), The Pruned State-Space System for Non-Linear DSGE Models: Theory and Empirical Applications, Review of Economic Studies, 85, p. 1-49 % Adapted for Dynare by Willi Mutschler (@wmutschl, willi@mutschler.eu), Jan 2021 % ========================================================================= -% Copyright © 2021 Dynare Team +% Copyright © 2021-2023 Dynare Team % % This file is part of Dynare. % @@ -257,8 +257,7 @@ dev_datamoments = str2double(AndreasenEtAl.moments@{orderApp}(:,5)) - oo_.mom.d dev_modelmoments = str2double(AndreasenEtAl.moments@{orderApp}(:,6)) - oo_.mom.model_moments; % There is no table command in Octave -% The table command also crashes on MATLAB R2014a because it does not like variable names -if ~isoctave && ~matlab_ver_less_than('8.4') +if ~isoctave table([AndreasenEtAl.Q@{orderApp} ; str2double(AndreasenEtAl.moments@{orderApp}(:,5)) ; str2double(AndreasenEtAl.moments@{orderApp}(:,6))],... [oo_.mom.Q ; oo_.mom.data_moments ; oo_.mom.model_moments ],... [dev_Q ; dev_datamoments ; dev_modelmoments ],... diff --git a/tests/histval_initval_file_unit_tests.m b/tests/histval_initval_file_unit_tests.m index 9d5f622b3d3276f0cc212460d3f1987606aa5e5e..80d2f58ee40185deda6afbf220f6dedff5fe0326 100644 --- a/tests/histval_initval_file_unit_tests.m +++ b/tests/histval_initval_file_unit_tests.m @@ -177,7 +177,7 @@ end fclose(fh); % The table() function is not implemented in Octave -if ~isoctave && ((ispc && ~matlab_ver_less_than('8.2')) || (~ispc && ~matlab_ver_less_than('9.0'))) +if ~isoctave writetable(table(x,y), 'data.xlsx') options = struct(); options.datafile = 'data.xlsx'; @@ -190,7 +190,7 @@ end % The table() function is not implemented in Octave % The test also does not work under GNU/Linux + MATLAB R2020b (Unicode issue in xlsread) -if ~isoctave && (ispc && ~matlab_ver_less_than('8.2')) +if ~isoctave && ispc writetable(table(x,y), 'data.xls') options = struct(); options.datafile = 'data.xls'; diff --git a/tests/occbin/model_borrcon/borrcon_common.inc b/tests/occbin/model_borrcon/borrcon_common.inc index 845c5d919584580ea029084d4e936af2730858e6..b4d12a463ba3720bebf2975054a34231eaca3f5d 100644 --- a/tests/occbin/model_borrcon/borrcon_common.inc +++ b/tests/occbin/model_borrcon/borrcon_common.inc @@ -17,11 +17,7 @@ ylabels = char(percent,percent,percent,level); figtitle = 'Simulated variables'; legendlist = cellstr(char('Piecewise Linear','Linear')); -if isoctave || ~matlab_ver_less_than('8.4') - % For some unknown reason, MATLAB R2014a crashes with TeX labels - % when -nodisplay is passed (as in the testsuite) - options_.TeX=1; -end +options_.TeX=1; occbin_graph; occbin_graph c_hat b_hat y_hat; diff --git a/windows/README.txt b/windows/README.txt index d87ff3c8a03d230360521c65ef29633243bb012a..6ea7c46c3de832e57886861c0a4500b2232431f4 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 works on top of MATLAB®, any version ranging from 8.3 (R2014a) to 23.2 +Dynare works on top of MATLAB®, any version ranging from 9.5 (R2018b) to 23.2 (R2023b). Only 64-bit versions are supported. 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 4d00734b76a0cbaae732e6347fc3243af25ceb17..b6909e4cfe1f70a2d1d7a4fc0d23f24f1f57679d 100755 --- a/windows/build.sh +++ b/windows/build.sh @@ -31,7 +31,6 @@ ROOT_DIRECTORY=$(dirname "$(readlink -f "$0")") # Check that build directories do not already exist [[ -d /tmp/windeps ]] && { echo "Please remove the /tmp/windeps directory" 2>&1; exit 1; } [[ -d "$ROOT_DIRECTORY"/../build-win-matlab ]] && { echo "Please remove the build-win-matlab directory" 2>&1; exit 1; } -[[ -d "$ROOT_DIRECTORY"/../build-win-old-matlab ]] && { echo "Please remove the build-win-old-matlab directory" 2>&1; exit 1; } [[ -d "$ROOT_DIRECTORY"/../build-win-octave ]] && { echo "Please remove the build-win-octave directory" 2>&1; exit 1; } # Create TMP folder and make sure it is deleted upon exit @@ -56,16 +55,11 @@ cd .. common_meson_opts=(-Dbuildtype=release --cross-file scripts/windows-cross.ini) -# Create Windows 64-bit DLL binaries for MATLAB ≥ R2018a -meson setup --cross-file scripts/windows-cross-matlab.ini -Dmatlab_path=/tmp/windeps/matlab64/R2018a \ +# Create Windows 64-bit DLL binaries for MATLAB ≥ R2018b +meson setup --cross-file scripts/windows-cross-matlab.ini -Dmatlab_path=/tmp/windeps/matlab64/R2018b \ "${common_meson_opts[@]}" build-win-matlab meson compile -v -C build-win-matlab -# Create Windows 64-bit DLL binaries for MATLAB ≥ R2014a and ≤ R2017b -meson setup --cross-file scripts/windows-cross-matlab.ini -Dmatlab_path=/tmp/windeps/matlab64/R2014a \ - "${common_meson_opts[@]}" build-win-old-matlab -meson compile -v -C build-win-old-matlab - # Create Windows DLL binaries for Octave/MinGW (64bit) meson setup --cross-file scripts/windows-cross-octave.ini \ "${common_meson_opts[@]}" build-win-octave @@ -87,7 +81,6 @@ fi # Strip binaries x86_64-w64-mingw32-strip build-win-matlab/preprocessor/src/dynare-preprocessor.exe x86_64-w64-mingw32-strip -- build-win-matlab/*.mexw64 -x86_64-w64-mingw32-strip -- build-win-old-matlab/*.mexw64 x86_64-w64-mingw32-strip -- build-win-octave/*.mex # Add a preprocessor copy for backward compatibility @@ -128,10 +121,8 @@ mkdir -p "$ZIPDIR"/contrib/ms-sbvar/TZcode cp -pr contrib/ms-sbvar/TZcode/MatlabFiles "$ZIPDIR"/contrib/ms-sbvar/TZcode mkdir -p "$ZIPDIR"/contrib/jsonlab cp -pr contrib/jsonlab/* "$ZIPDIR"/contrib/jsonlab -mkdir -p "$ZIPDIR"/mex/matlab/win64-8.3-9.3 -cp -p build-win-old-matlab/*.mexw64 "$ZIPDIR"/mex/matlab/win64-8.3-9.3 -mkdir -p "$ZIPDIR"/mex/matlab/win64-9.4-23.2 -cp -p build-win-matlab/*.mexw64 "$ZIPDIR"/mex/matlab/win64-9.4-23.2 +mkdir -p "$ZIPDIR"/mex/matlab/win64-9.5-23.2 +cp -p build-win-matlab/*.mexw64 "$ZIPDIR"/mex/matlab/win64-9.5-23.2 mkdir -p "$ZIPDIR"/mex/octave/win64 cp -p build-win-octave/*.mex "$ZIPDIR"/mex/octave/win64 mkdir "$ZIPDIR"/preprocessor diff --git a/windows/deps/versions.mk b/windows/deps/versions.mk index a0a4032ae8d0e11b0eb4b8eb923ed6b29ef1cb5c..5b65665cd76985dc74b11035d9599375c5010d88 100644 --- a/windows/deps/versions.mk +++ b/windows/deps/versions.mk @@ -4,7 +4,7 @@ X13AS_VERSION = 1-1-b60 OCTAVE_VERSION = 8.4.0 OCTAVE_W64_BUILD = -MATLAB64_VERSION = 20200930 +MATLAB64_VERSION = 20231122 ### MSYS2 packages diff --git a/windows/dynare.nsi b/windows/dynare.nsi index f3234fb20c430a0b86856a8c8a13801e27d38866..fb9bf6374caac25f92ea017d0bbbb543489f169a 100644 --- a/windows/dynare.nsi +++ b/windows/dynare.nsi @@ -90,13 +90,8 @@ Section "Dynare core (preprocessor and M-files)" SectionEnd -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 ..\build-win-old-matlab\*.mexw64 -SectionEnd - -Section "MEX files for MATLAB 64-bit, version 9.4 to 23.2 (R2018a to R2023b)" - SetOutPath $INSTDIR\mex\matlab\win64-9.4-23.2 +Section "MEX files for MATLAB 64-bit, version 9.5 to 23.2 (R2018b to R2023b)" + SetOutPath $INSTDIR\mex\matlab\win64-9.5-23.2 File ..\build-win-matlab\*.mexw64 SectionEnd