diff --git a/examples/ramst.mod b/examples/ramst.mod index df4029ad4..90654a4ef 100644 --- a/examples/ramst.mod +++ b/examples/ramst.mod @@ -74,8 +74,11 @@ periods 1; values 1.2; end; -// Deterministic simulation of the model for 200 periods -simul(periods=200); +// Prepare the deterministic simulation of the model over 200 periods +perfect_foresight_setup(periods=200); + +// Perform the simulation +perfect_foresight_solver; // Display the path of consumption and capital rplot c; diff --git a/license.txt b/license.txt index 651112b5c..afb06aa4b 100644 --- a/license.txt +++ b/license.txt @@ -143,23 +143,24 @@ Copyright: 2005 Henning Schmidt, FCC, henning@fcc.chalmers.se License: GPL-3+ Files: matlab/missing/stats/normpdf.m matlab/missing/stats/gamcdf.m - matlab/missing/stats/common_size.m matlab/missing/stats/chi2inv.m + matlab/missing/stats/chi2inv.m matlab/missing/stats/gaminv.m matlab/missing/stats/gampdf.m matlab/missing/stats/stdnormal_inv.m matlab/missing/stats/betacdf.m matlab/missing/stats/betapdf.m matlab/missing/stats/normcdf.m matlab/missing/stats/stdnormal_cdf.m matlab/missing/stats/norminv.m matlab/missing/stats/stdnormal_pdf.m matlab/missing/stats/betainv.m + matlab/missing/stats-matlab/common_size.m Copyright: 1995-2007 Kurt Hornik 2008-2011 Dynare Team License: GPL-3+ -Files: matlab/missing/stats/quantile.m +Files: matlab/missing/stats-matlab/quantile.m Copyright: 2014-2016 Christopher Hummersone 2016 Dynare Team License: GPL-3+ -Files: matlab/missing/stats/corr.m +Files: matlab/missing/stats-matlab/corr.m Copyright: 1993-1996 Kurt Hornik 1996-2015 John W. Eaton 2013-2015 Julien Bect diff --git a/matlab/dynare.m b/matlab/dynare.m index 6c25e1915..e04d24d79 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -71,16 +71,23 @@ dynareroot = dynare_config('', preprocessoroutput); warning_config() if isoctave - if octave_ver_less_than(supported_octave_version) + % The supported_octave_version.m file is not in git nor in the source + % package, it is manually added in binary packages distributed on dynare.org + if exist('supported_octave_version', 'file') && ~strcmp(supported_octave_version, version) skipline() warning(['This version of Octave is not supported. Consider installing ' ... - 'version %s+ of Octave,\notherwise m files will be used instead ' ... - 'of precompiled mex files and some features, like solution\n' ... + 'version %s of Octave\n' ... + 'from www.octave.org, otherwise m files will be used instead ' ... + 'of precompiled mex files and some\nfeatures, like solution ' ... 'of models approximated at third order, will not be available.'], supported_octave_version()) skipline() + elseif octave_ver_less_than('4.2') % Should match the test in mex/build/octave/configure.ac + skipline() + warning(['This version of Dynare has only been tested on Octave 4.2 and above. Dynare may fail to run or give unexpected result. Consider upgrading your version of Octave.']) + skipline() end else - if matlab_ver_less_than('7.5') + if matlab_ver_less_than('7.5') % Should match the test in mex/build/matlab/configure.ac skipline() warning('This version of Dynare has only been tested on MATLAB 7.5 (R2007b) 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() diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index cbba26268..2e3a2eacd 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -79,16 +79,11 @@ p = {'/distributions/' ; ... % For functions that exist only under some Octave versions % or some MATLAB versions, and for which we provide some replacement functions +% Replacements for rows(), columns(), vec() and issquare() (inexistent under MATLAB) if ~isoctave - % Replacements for rows(), columns() and issquare() (inexistent under MATLAB) p{end+1} = '/missing/rows_columns'; p{end+1} = '/missing/issquare'; - % Replacement for vec() (inexistent under MATLAB) p{end+1} = '/missing/vec'; - if ~user_has_matlab_license('statistics_toolbox') - % Replacements for functions of the stats toolbox - p{end+1} = '/missing/stats/'; - end end % ordeig() doesn't exist in Octave @@ -108,6 +103,16 @@ if (isoctave && ~user_has_octave_forge_package('statistics')) ... p{end+1} = '/missing/nanmean'; end +% Replacements for functions of the MATLAB statistics toolbox +% These functions were part of Octave < 4.4, they are now in the statistics Forge package +if (isoctave && ~octave_ver_less_than('4.4') && ~user_has_octave_forge_package('statistics')) ... + || (~isoctave && ~user_has_matlab_license('statistics_toolbox')) + p{end+1} = '/missing/stats/'; + if ~isoctave + p{end+1} = '/missing/stats-matlab/'; + end +end + % Check if struct2array is available. if ~exist('struct2array') p{end+1} = '/missing/struct2array'; diff --git a/matlab/identification_analysis.m b/matlab/identification_analysis.m index 108945134..768bc5b31 100644 --- a/matlab/identification_analysis.m +++ b/matlab/identification_analysis.m @@ -102,6 +102,7 @@ if info(1)==0 derivatives_info.DOm=dOm; derivatives_info.DYss=dYss; options_.ar=nlags; + options_ident.ar=nlags; indJJ = (find(max(abs(JJ'),[],1)>1.e-8)); end if length(indJJ). - -v = '4.2.1'; \ No newline at end of file diff --git a/matlab/user_has_octave_forge_package.m b/matlab/user_has_octave_forge_package.m index 07d918d42..a3f1bc38d 100644 --- a/matlab/user_has_octave_forge_package.m +++ b/matlab/user_has_octave_forge_package.m @@ -20,4 +20,11 @@ function [hasPackage] = user_has_octave_forge_package(package) [desc,flag] = pkg('describe', package); -hasPackage = isequal(flag{1,1}, 'Loaded'); +if isequal(flag{1,1}, 'Not installed') + hasPackage = 0; +else + if isequal(flag{1,1}, 'Not loaded') + pkg('load', package); + end + hasPackage = 1; +end diff --git a/mex/build/matlab/configure.ac b/mex/build/matlab/configure.ac index 668706229..40e93d6f8 100644 --- a/mex/build/matlab/configure.ac +++ b/mex/build/matlab/configure.ac @@ -34,6 +34,7 @@ if test "x$ax_enable_matlab" = "xyes"; then if test "x$ax_matlab_version_ok" = "xyes"; then AX_MEXOPTS + AX_COMPARE_VERSION([$MATLAB_VERSION], [lt], [7.5], [AC_MSG_ERROR([Your MATLAB is too old, please upgrade to version 7.5 (R2007b) at least.])]) fi CFLAGS="$MATLAB_CFLAGS" diff --git a/preprocessor b/preprocessor index a30f8f365..84c2dc5f3 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit a30f8f365e89b9520fa44caa6c3c1c288c0adbba +Subproject commit 84c2dc5f3621d47407397d519b623eb9d1fc1eb3 diff --git a/tests/deterministic_simulations/rbc_det.mod b/tests/deterministic_simulations/rbc_det.mod index 71fdbd59f..1454609c0 100644 --- a/tests/deterministic_simulations/rbc_det.mod +++ b/tests/deterministic_simulations/rbc_det.mod @@ -17,7 +17,7 @@ sigma2 = 0; model; // Eq. n°1: - efficiency = rho*efficiency(-1) + EfficiencyInnovation; + efficiency = rho*efficiency(-1) + EfficiencyInnovation(-2); // Use a lag of two to test the maximum_lag logic // Eq. n°2: Efficiency = effstar*exp(efficiency); diff --git a/tests/deterministic_simulations/rbc_det_stack_solve_algo_7.mod b/tests/deterministic_simulations/rbc_det_stack_solve_algo_7.mod index a4c829ffb..baf60baf2 100644 --- a/tests/deterministic_simulations/rbc_det_stack_solve_algo_7.mod +++ b/tests/deterministic_simulations/rbc_det_stack_solve_algo_7.mod @@ -17,7 +17,7 @@ sigma2 = 0; model; // Eq. n°1: - efficiency = rho*efficiency(-1) + EfficiencyInnovation; + efficiency = rho*efficiency(-1) + EfficiencyInnovation(-2); // Use a lag of two to test the maximum_lag logic // Eq. n°2: Efficiency = effstar*exp(efficiency);