From 8b86f8a25bb1a0e8f6bc51898d317022dfb6139b Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 9 Oct 2019 10:02:25 +0200 Subject: [PATCH 1/6] ignore unused output variable --- matlab/dynare.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/matlab/dynare.m b/matlab/dynare.m index 4ae72b8d5..d5b86f54b 100644 --- a/matlab/dynare.m +++ b/matlab/dynare.m @@ -152,7 +152,7 @@ end if ~isempty(strfind(fname,filesep)) fprintf('\nIt seems you are trying to call a .mod file not located in the "Current Folder". This is not possible (the %s symbol is not allowed in the name of the .mod file).\n', filesep) - [pathtomodfile,basename,ext] = fileparts(fname); + [pathtomodfile,basename] = fileparts(fname); if exist(pathtomodfile,'dir') filesindirectory = dir(pathtomodfile); filesindirectory = struct2cell(filesindirectory); From 4a1b5eccb22362b5de03645959f5ceb764b6147c Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Tue, 8 Oct 2019 16:10:30 +0200 Subject: [PATCH 2/6] Support MATLAB namespaces in function calls #1639 shorten test names because adding `_namespace` made some .mod file names too long --- preprocessor | 2 +- tests/Makefile.am | 14 +++--- .../+namespace/extFunNoDerivsNamespace.m | 3 ++ .../extFunWithFirstAndSecondDerivsNamespace.m | 9 ++++ ...ided.mod => first_and_2nd_deriv_given.mod} | 0 ....mod => first_and_2nd_deriv_given_dll.mod} | 0 ...irst_and_2nd_deriv_given_dll_namespace.mod | 48 +++++++++++++++++++ .../first_and_2nd_deriv_given_namespace.mod | 48 +++++++++++++++++++ ...fcn_provided.mod => first_deriv_given.mod} | 0 ...ided_dll.mod => first_deriv_given_dll.mod} | 0 ...v_fcns_provided.mod => no_deriv_given.mod} | 0 ...rovided_dll.mod => no_deriv_given_dll.mod} | 0 12 files changed, 117 insertions(+), 7 deletions(-) create mode 100644 tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m create mode 100644 tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m rename tests/external_function/{first_and_2nd_deriv_fcns_provided.mod => first_and_2nd_deriv_given.mod} (100%) rename tests/external_function/{first_and_2nd_deriv_fcns_provided_dll.mod => first_and_2nd_deriv_given_dll.mod} (100%) create mode 100644 tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod create mode 100644 tests/external_function/first_and_2nd_deriv_given_namespace.mod rename tests/external_function/{first_deriv_fcn_provided.mod => first_deriv_given.mod} (100%) rename tests/external_function/{first_deriv_fcn_provided_dll.mod => first_deriv_given_dll.mod} (100%) rename tests/external_function/{no_deriv_fcns_provided.mod => no_deriv_given.mod} (100%) rename tests/external_function/{no_deriv_fcns_provided_dll.mod => no_deriv_given_dll.mod} (100%) diff --git a/preprocessor b/preprocessor index fac9e4436..9e454debb 160000 --- a/preprocessor +++ b/preprocessor @@ -1 +1 @@ -Subproject commit fac9e4436c1c1f7d97e03d5fee77f7fb45dff54a +Subproject commit 9e454debb5eb7cbabcf29e844e16f2463d8d7eb6 diff --git a/tests/Makefile.am b/tests/Makefile.am index 1b6fef014..5b4698caa 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -173,12 +173,14 @@ MODFILES = \ dsge-var/simul_hybrid.mod \ dsge-var/dsgevar_forward_calibrated_lambda.mod \ dsge-var/dsgevar_forward_estimated_lambda.mod \ - external_function/first_and_2nd_deriv_fcns_provided.mod \ - external_function/first_and_2nd_deriv_fcns_provided_dll.mod \ - external_function/first_deriv_fcn_provided.mod \ - external_function/first_deriv_fcn_provided_dll.mod \ - external_function/no_deriv_fcns_provided.mod \ - external_function/no_deriv_fcns_provided_dll.mod \ + external_function/first_deriv_given.mod \ + external_function/first_deriv_given_dll.mod \ + external_function/first_and_2nd_deriv_given.mod \ + external_function/first_and_2nd_deriv_given_namespace.mod \ + external_function/first_and_2nd_deriv_given_dll.mod \ + external_function/first_and_2nd_deriv_given_dll_namespace.mod \ + external_function/no_deriv_given.mod \ + external_function/no_deriv_given_dll.mod \ seeds.mod \ identification/kim/kim2.mod \ identification/as2007/as2007.mod \ diff --git a/tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m b/tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m new file mode 100644 index 000000000..a05eb9861 --- /dev/null +++ b/tests/external_function/+matlab/+namespace/extFunNoDerivsNamespace.m @@ -0,0 +1,3 @@ +function y=extFunNoDerivsNamespace(a,b) +y=a*(b^2); +end \ No newline at end of file diff --git a/tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m b/tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m new file mode 100644 index 000000000..25d4a80f7 --- /dev/null +++ b/tests/external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m @@ -0,0 +1,9 @@ +function [y df d2f]=extFunWithFirstAndSecondDerivsNamespace(a,b) +y=a*(b^2); + +da=b^2; +db=2*a*b; +df=[da db]; + +d2f=[0 2*b; 2*b 2*a]; +end \ No newline at end of file diff --git a/tests/external_function/first_and_2nd_deriv_fcns_provided.mod b/tests/external_function/first_and_2nd_deriv_given.mod similarity index 100% rename from tests/external_function/first_and_2nd_deriv_fcns_provided.mod rename to tests/external_function/first_and_2nd_deriv_given.mod diff --git a/tests/external_function/first_and_2nd_deriv_fcns_provided_dll.mod b/tests/external_function/first_and_2nd_deriv_given_dll.mod similarity index 100% rename from tests/external_function/first_and_2nd_deriv_fcns_provided_dll.mod rename to tests/external_function/first_and_2nd_deriv_given_dll.mod diff --git a/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod b/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod new file mode 100644 index 000000000..a868c4193 --- /dev/null +++ b/tests/external_function/first_and_2nd_deriv_given_dll_namespace.mod @@ -0,0 +1,48 @@ +// Example 1 from Collard's guide to Dynare +var y, c, k, a, h, b; +varexo e, u; + +parameters beta, rho, alpha, delta, theta, psi, tau; + +alpha = 0.36; +rho = 0.95; +tau = 0.025; +beta = 0.99; +delta = 0.025; +psi = 0; +theta = 2.95; + +phi = 0.1; + +addpath(pwd) + +external_function(nargs=2, name=matlab.namespace.extFunWithFirstAndSecondDerivsNamespace, first_deriv_provided, second_deriv_provided); + +model(use_dll); +c*theta*h^(1+psi)=(1-alpha)*y; +k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) + *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); +y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); +k = exp(b)*(y-c)+matlab.namespace.extFunWithFirstAndSecondDerivsNamespace((1-delta),k(-1)); +a = rho*a(-1)+tau*b(-1) + e; +b = tau*a(-1)+rho*b(-1) + u; +end; + +initval; +y = 1.08068253095672; +c = 0.80359242014163; +h = 0.29175631001732; +k = 11.08360443260358; +a = 0; +b = 0; +e = 0; +u = 0; +end; + +shocks; +var e; stderr 0.009; +var u; stderr 0.009; +var e, u = phi*0.009*0.009; +end; + +stoch_simul; diff --git a/tests/external_function/first_and_2nd_deriv_given_namespace.mod b/tests/external_function/first_and_2nd_deriv_given_namespace.mod new file mode 100644 index 000000000..1cefa8399 --- /dev/null +++ b/tests/external_function/first_and_2nd_deriv_given_namespace.mod @@ -0,0 +1,48 @@ +// Example 1 from Collard's guide to Dynare +var y, c, k, a, h, b; +varexo e, u; + +parameters beta, rho, alpha, delta, theta, psi, tau; + +alpha = 0.36; +rho = 0.95; +tau = 0.025; +beta = 0.99; +delta = 0.025; +psi = 0; +theta = 2.95; + +phi = 0.1; + +addpath(pwd) + +external_function(nargs=2, name=matlab.namespace.extFunWithFirstAndSecondDerivsNamespace, first_deriv_provided, second_deriv_provided); + +model; +c*theta*h^(1+psi)=(1-alpha)*y; +k = beta*(((exp(b)*c)/(exp(b(+1))*c(+1))) + *(exp(b(+1))*alpha*y(+1)+(1-delta)*k)); +y = exp(a)*(k(-1)^alpha)*(h^(1-alpha)); +k = exp(b)*(y-c)+matlab.namespace.extFunWithFirstAndSecondDerivsNamespace((1-delta),k(-1)); +a = rho*a(-1)+tau*b(-1) + e; +b = tau*a(-1)+rho*b(-1) + u; +end; + +initval; +y = 1.08068253095672; +c = 0.80359242014163; +h = 0.29175631001732; +k = 11.08360443260358; +a = 0; +b = 0; +e = 0; +u = 0; +end; + +shocks; +var e; stderr 0.009; +var u; stderr 0.009; +var e, u = phi*0.009*0.009; +end; + +stoch_simul; diff --git a/tests/external_function/first_deriv_fcn_provided.mod b/tests/external_function/first_deriv_given.mod similarity index 100% rename from tests/external_function/first_deriv_fcn_provided.mod rename to tests/external_function/first_deriv_given.mod diff --git a/tests/external_function/first_deriv_fcn_provided_dll.mod b/tests/external_function/first_deriv_given_dll.mod similarity index 100% rename from tests/external_function/first_deriv_fcn_provided_dll.mod rename to tests/external_function/first_deriv_given_dll.mod diff --git a/tests/external_function/no_deriv_fcns_provided.mod b/tests/external_function/no_deriv_given.mod similarity index 100% rename from tests/external_function/no_deriv_fcns_provided.mod rename to tests/external_function/no_deriv_given.mod diff --git a/tests/external_function/no_deriv_fcns_provided_dll.mod b/tests/external_function/no_deriv_given_dll.mod similarity index 100% rename from tests/external_function/no_deriv_fcns_provided_dll.mod rename to tests/external_function/no_deriv_given_dll.mod From cd83a7790e6644a8af7f57c56ad840352d794c9f Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 9 Oct 2019 16:35:32 +0200 Subject: [PATCH 3/6] add .m files from 4a1b5eccb22362b5de03645959f5ceb764b6147c to EXTRA_DIST [skip ci] --- tests/Makefile.am | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/Makefile.am b/tests/Makefile.am index 5b4698caa..38d0bdd2d 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -802,6 +802,8 @@ EXTRA_DIST = \ external_function/extFunDeriv.m \ external_function/extFunNoDerivs.m \ external_function/extFunWithFirstAndSecondDerivs.m \ + external_function/+matlab/+namespace/extFunNoDerivsNamespace.m \ + external_function/+matlab/+namespace/extFunWithFirstAndSecondDerivsNamespace.m \ expectations/expectation_ss_old_steadystate.m \ filter_step_ahead/trend_cycle_decomposition_data.m \ steady_state/walsh1_old_ss_steadystate.m \ From 43c73a74c8c88d81e13b832824770ede3702e715 Mon Sep 17 00:00:00 2001 From: Houtan Bastani Date: Wed, 9 Oct 2019 16:39:33 +0200 Subject: [PATCH 4/6] test for matlab namespace function in steady_state_model block. closes #1639 --- tests/+matlab/+namespace/y_k.m | 3 +++ tests/Makefile.am | 1 + tests/walsh.mod | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 tests/+matlab/+namespace/y_k.m diff --git a/tests/+matlab/+namespace/y_k.m b/tests/+matlab/+namespace/y_k.m new file mode 100644 index 000000000..7257ecd15 --- /dev/null +++ b/tests/+matlab/+namespace/y_k.m @@ -0,0 +1,3 @@ +function retval = y_k(alpha, beta, delta) + retval = (1/alpha)*(1/beta-1+delta); +end diff --git a/tests/Makefile.am b/tests/Makefile.am index 38d0bdd2d..a0f838117 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -777,6 +777,7 @@ EXTRA_DIST = \ run_reporting_test_matlab.m \ run_reporting_test_octave.m \ run_all_unitary_tests.m \ + +matlab/+namespace/y_k.m \ reporting/AnnualTable.m \ reporting/CommResidTablePage.m \ reporting/CountryGraphPage.m \ diff --git a/tests/walsh.mod b/tests/walsh.mod index 606746ca1..fced66cca 100644 --- a/tests/walsh.mod +++ b/tests/walsh.mod @@ -67,7 +67,7 @@ steady_state_model; // adapting solution Walsh (2003) p. 84 en = 1/3; eR = 1/beta; -y_k = (1/alpha)*(1/beta-1+delta); +y_k = matlab.namespace.y_k(alpha, beta, delta); ek = en*y_k^(-1/(1-alpha)); ec = ek*(y_k-delta); em = ec*(a/(1-a))^(-1/b)*((thetass-beta)/thetass)^(-1/b); From 0c6ad30b7bffcb01e2e8fd915d87c31853d11f70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 14 Oct 2019 12:01:37 +0200 Subject: [PATCH 5/6] Manual: update installation procedure for GNU/Linux In particular, mention the Linux Mint and Arch Linux packages. --- .../source/installation-and-configuration.rst | 56 +++++++++++++------ 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index 87b106255..6e82a5c1f 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -7,10 +7,10 @@ Installation and configuration Software requirements ===================== -Packaged versions of Dynare are available for Windows 7/8/10, -`Debian GNU/Linux `__, `Ubuntu`_ and macOS 10.8 -or later. Dynare should work on other systems, but some compilation -steps are necessary in that case. +Packaged versions of Dynare are available for Windows 7/8/10, several GNU/Linux +distributions (Debian, Ubuntu, Linux Mint, Arch Linux) and macOS +10.8 or later. Dynare should work on other systems, but some compilation steps +are necessary in that case. In order to run Dynare, you need one of the following: @@ -55,13 +55,26 @@ example in ``c:\dynare``), as long as you correctly adjust your path settings (see see :ref:`words-warning`). -On Debian GNU/Linux and Ubuntu ------------------------------- +On GNU/Linux +------------ -Please refer to the `Dynare wiki`_ for detailed instructions. +On Debian, Ubuntu and Linux Mint, the Dynare package can be installed with: +``apt install dynare``. This will give a fully-functional Dynare installation +usable with Octave. If you have MATLAB installed, you should also do: ``apt +install dynare-matlab`` (under Debian, this package is in the ``contrib`` +section). Documentation can be installed with ``apt install dynare-doc``. The +status of those packages can be checked at those pages: + +* `Package status in Debian`_ +* `Package status in Ubuntu`_ +* `Package status in Linux Mint`_ + +On Arch Linux, the Dynare package is not in the official repositories, but is +available in the `Arch User Repository`_. The needed sources can be +downloaded from the `package status in Arch Linux`_. Dynare will be installed under ``/usr/lib/dynare``. Documentation will -be under ``/usr/share/doc/dynare-doc``. +be under ``/usr/share/doc/dynare-doc`` (only on Debian, Ubuntu and Linux Mint). On macOS @@ -112,15 +125,16 @@ There is no prerequisites on Windows. Dynare now ships a compilation environment that can be used with the :opt:`use_dll` option. -Prerequisites on Debian GNU/Linux and Ubuntu --------------------------------------------- +Prerequisites on GNU/Linux +-------------------------- -Users of MATLAB under GNU/Linux need a working compilation -environment installed. If not already present, it can be installed via -``apt install build-essential``. +Users of MATLAB under GNU/Linux need a working compilation environment +installed. Under Debian, Ubuntu or Linux Mint, it can be installed via ``apt +install build-essential``. Users of Octave under GNU/Linux should install the package for MEX file -compilation (under Debian or Ubuntu, it is called ``liboctave-dev``). +compilation (under Debian, Ubuntu or Linux Mint, it can be done via ``apt +install liboctave-dev``). Prerequisites on macOS ---------------------- @@ -152,7 +166,7 @@ installation to MATLAB path. You have two options for doing that: >> addpath c:/dynare/4.x.y/matlab - Under Debian GNU/Linux or Ubuntu, type:: + Under GNU/Linux, type:: >> addpath /usr/lib/dynare/matlab @@ -187,8 +201,10 @@ type:: octave:1> addpath c:/dynare/4.x.y/matlab -Under Debian GNU/Linux or Ubuntu, there is no need to use the -``addpath`` command; the packaging does it for you. +Under Debian, Ubuntu or Linux Mint, there is no need to use the ``addpath`` +command; the packaging does it for you. Under Arch Linux, you need to do:: + + octave:1> addpath /usr/lib/dynare/matlab Under macOS, assuming that you have installed Dynare and Octave via Homebrew, type:: @@ -232,7 +248,11 @@ Dynare unusable. end up with a non optimal or un-usable installation of Dynare. -.. _Ubuntu: http://www.ubuntu.com/ +.. _Package status in Debian: https://packages.debian.org/sid/dynare +.. _Package status in Ubuntu: https://launchpad.net/ubuntu/+source/dynare +.. _Package status in Linux Mint: https://community.linuxmint.com/software/view/dynare +.. _Package status in Arch Linux: https://aur.archlinux.org/packages/dynare/ +.. _Arch User Repository: https://wiki.archlinux.org/index.php/Arch_User_Repository .. _Dynare website: https://www.dynare.org/ .. _Dynare wiki: https://git.dynare.org/Dynare/dynare/wikis .. _Octave-Forge: https://octave.sourceforge.io/ From 76cf92578be6f1678d60f89e1854e064aae0cdad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Mon, 14 Oct 2019 12:03:40 +0200 Subject: [PATCH 6/6] Manual: document silent installation on Windows Closes #1478 --- doc/manual/source/installation-and-configuration.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index 6e82a5c1f..8543fa3e2 100644 --- a/doc/manual/source/installation-and-configuration.rst +++ b/doc/manual/source/installation-and-configuration.rst @@ -54,6 +54,10 @@ Note that you can have several versions of Dynare coexisting (for example in ``c:\dynare``), as long as you correctly adjust your path settings (see see :ref:`words-warning`). +Also note that it is possible to do a silent installation, by passing the +``/S`` flag to the installer on the command line. This can be useful when +doing an unattended installation of Dynare on a computer pool. + On GNU/Linux ------------