diff --git a/doc/manual/source/installation-and-configuration.rst b/doc/manual/source/installation-and-configuration.rst index 87b106255..8543fa3e2 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: @@ -54,14 +54,31 @@ 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 Debian GNU/Linux and Ubuntu ------------------------------- -Please refer to the `Dynare wiki`_ for detailed instructions. +On GNU/Linux +------------ + +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 +129,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 +170,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 +205,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 +252,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/ 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); 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/+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 e82d6a6a6..067b2c507 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -174,12 +174,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 \ @@ -953,6 +955,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 \ @@ -978,6 +981,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 \ 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 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);