diff --git a/doc/manual.xml b/doc/manual.xml index bdce693bf4080a60c08749f3a3bc90bc48c3c74e..3568a3f10f2ad6f108278bab2e60464448729eed 100644 --- a/doc/manual.xml +++ b/doc/manual.xml @@ -112,7 +112,7 @@ Dynare should work on other systems, but some compilation steps are necessary in <para>Some installation instructions for GNU Octave can be found on <ulink url="http://www.dynare.org/DynareWiki/DynareOctave">Dynare Wiki</ulink>.</para> -<para>If you are using MATLAB for Windows, and if you plan to use options <xref linkend="use_dll"/> or <xref linkend="k_order_solver"/>, you will need to install a C++ compiler on your machine. The easiest solution is to install <ulink url="http://www.microsoft.com/Express/VC/"><trademark class="registered">Microsoft</trademark> Visual C++ 2008 Express Edition</ulink>, and then to type <literal>mex -setup</literal> on the MATLAB prompt (it should autodetect the compiler). For users of MATLAB 64-bit, please refer to <ulink url="http://www.mathworks.fr/support/solutions/en/data/1-6IJJ3L/index.html?solution=1-6IJJ3L">these instructions</ulink>. Users of MATLAB under Linux and MacOS, and users of GNU Octave normally need to do nothing, since a working compilation environment is available by default.</para> +<para>If you are using MATLAB for Windows, and if you plan to use options <xref linkend="use_dll"/> or <xref linkend="k_order_solver"/>, you will need to install the GNU C++ compiler (g++) on your machine, and configure it with MATLAB (see <ulink url="http://www.dynare.org/DynareWiki/ConfigureMatlabWindowsForMexCompilation">instructions on the Dynare wiki</ulink>). Users of MATLAB under Linux and MacOS, and users of GNU Octave normally need to do nothing, since a working compilation environment is available by default.</para> </sect1> @@ -1834,7 +1834,7 @@ The simulated endogenous variables are available in global matrix <varname>oo_.e </varlistentry> <varlistentry id="k_order_solver"> <term><option>k_order_solver</option></term> - <listitem><para>Use a k-order solver, implemented in C++, instead of the default Dynare solver. You need a working compilation environment, <foreignphrase>i.e.</foreignphrase> a working <literal>mex</literal> command (see <xref linkend="software-requirements"/> for more details). Default: disabled for order 1 and 2, enabled otherwise</para></listitem> + <listitem><para>Use a k-order solver, implemented in C++, instead of the default Dynare solver. When using this option, you must specify the <xref linkend="use_dll"/> option, and you need a working compilation environment, <foreignphrase>i.e.</foreignphrase> a working <literal>mex</literal> command (see <xref linkend="software-requirements"/> for more details). Default: disabled for order 1 and 2, enabled otherwise</para></listitem> </varlistentry> <varlistentry> <term><option>periods</option> = <replaceable>INTEGER</replaceable></term> diff --git a/preprocessor/ComputingTasks.cc b/preprocessor/ComputingTasks.cc index dcf3b6eb5e07b921def49ed0438833e2b8f79243..acdd5a9217432aa9ac2048400956013c9271b965 100644 --- a/preprocessor/ComputingTasks.cc +++ b/preprocessor/ComputingTasks.cc @@ -118,6 +118,12 @@ StochSimulStatement::checkPass(ModFileStructure &mod_file_struct) it = options_list.num_options.find("partial_information"); if (it != options_list.num_options.end() && it->second == "1") mod_file_struct.partial_information = true; + + // Option k_order_solver (implicit when order >= 3) + it = options_list.num_options.find("k_order_solver"); + if ((it != options_list.num_options.end() && it->second == "1") + || mod_file_struct.order_option >= 3) + mod_file_struct.k_order_solver = true; } void @@ -174,6 +180,12 @@ RamseyPolicyStatement::checkPass(ModFileStructure &mod_file_struct) it = options_list.num_options.find("partial_information"); if (it != options_list.num_options.end() && it->second == "1") mod_file_struct.partial_information = true; + + // Option k_order_solver (implicit when order >= 3) + it = options_list.num_options.find("k_order_solver"); + if ((it != options_list.num_options.end() && it->second == "1") + || mod_file_struct.order_option >= 3) + mod_file_struct.k_order_solver = true; } void @@ -730,6 +742,12 @@ OsrStatement::checkPass(ModFileStructure &mod_file_struct) it = options_list.num_options.find("partial_information"); if (it != options_list.num_options.end() && it->second == "1") mod_file_struct.partial_information = true; + + // Option k_order_solver (implicit when order >= 3) + it = options_list.num_options.find("k_order_solver"); + if ((it != options_list.num_options.end() && it->second == "1") + || mod_file_struct.order_option >= 3) + mod_file_struct.k_order_solver = true; } void diff --git a/preprocessor/ModFile.cc b/preprocessor/ModFile.cc index 341d9b0329321b3a0cd0d50345a671a83e39d550..e3349675a6e09c328ea11d6bc52010ee2d24977d 100644 --- a/preprocessor/ModFile.cc +++ b/preprocessor/ModFile.cc @@ -118,6 +118,12 @@ ModFile::checkPass() exit(EXIT_FAILURE); } + if (mod_file_struct.k_order_solver && !use_dll) + { + cerr << "ERROR: When using option 'k_order_solver' (which is implicit if order >= 3), you must specify option 'use_dll' on the 'model' block" << endl; + exit(EXIT_FAILURE); + } + if (use_dll && (block || byte_code)) { cerr << "ERROR: In 'model' block, 'use_dll' option is not compatible with 'block' or 'bytecode'" << endl; diff --git a/preprocessor/ModFile.hh b/preprocessor/ModFile.hh index 9c735b55a7256478bfc740c126a2b260c0c6b40b..118b850482f6d59e3ade0ee2f83b6ec0616ff63d 100644 --- a/preprocessor/ModFile.hh +++ b/preprocessor/ModFile.hh @@ -57,10 +57,10 @@ public: //! Is the model block decomposed? bool block; - //! Is the model stored in baytecode format (byte_code=true) or in a M-file (byte_code=false) + //! Is the model stored in bytecode format (byte_code=true) or in a M-file (byte_code=false) bool byte_code; - //! Deprecated option use_dll + //! Is the model stored in a MEX file ? (option "use_dll" of "model") bool use_dll; //! Global evaluation context diff --git a/preprocessor/Statement.cc b/preprocessor/Statement.cc index ccd1549e5bc5a005dd69cbdc394abb9f083f7232..3f16dc1e934fb486ce1ff1aab4228c7fee0aecce 100644 --- a/preprocessor/Statement.cc +++ b/preprocessor/Statement.cc @@ -31,7 +31,8 @@ ModFileStructure::ModFileStructure() : svar_identification_present(false), identification_present(false), partial_information(false), - shocks_present(false) + shocks_present(false), + k_order_solver(false) { } diff --git a/preprocessor/Statement.hh b/preprocessor/Statement.hh index 55844d425e52f4118faab237f513f686629fdd62..277731ed7b64a4501f97ce625a8342b4ceec09e9 100644 --- a/preprocessor/Statement.hh +++ b/preprocessor/Statement.hh @@ -59,6 +59,8 @@ public: //! Whether a shocks or mshocks block is present /*! Used for the workaround for trac ticket #35 */ bool shocks_present; + //! Whether the "k_order_solver" option is used (explictly, or implicitly if order >= 3) + bool k_order_solver; }; class Statement