Commit Graph

2099 Commits (4a974bb428d3960aface3e1760b33e169c7c733a)

Author SHA1 Message Date
Sébastien Villemot 4a974bb428
The preprocessor now compiles the MEX when use_dll is specified
New options "mexext" and "matlabroot" are introduced, so that the preprocessor
knows where to find MATLAB and which architecture to compile for.

Only recent gcc is now supported. A set of optimization flags is used so that
compilation goes reasonably fast on large models.

Consequently, options "msvc", "mingw" and "cygwin" have been removed.
2018-10-26 18:09:13 +02:00
Sébastien Villemot 1c33af4844
Fix bug introduced in bfd93f4ac0 with correlations in estim_params
For correlations, there is one extra columns (since there are two symbol
indices). MATLAB automatically adds the missing column, while Octave is
stricter when verifying dimensions.

By the way, add a missing comma.
2018-10-26 11:11:10 +02:00
Stéphane Adjemia (Scylla) bfd93f4ac0
Fixed estimated_params_init behaviour...
... when an initial value is given to a parameter that is not
estimated.

The generated driver file was crashing with cryptic error message
because we were searching in the first (and second) column of a
potentially empty array with 0 columns. The fix is to initialize the
fields of estimated_params_ with empty arrays with 10 columns (ie
zeros(0, 10)). Also print a message in the matlab command window if
parameter declared in estimated_params_init is not estimated.
2018-10-25 10:24:25 +02:00
Houtan Bastani bef7c2a193 remove need to declare equations nonstationary 2018-10-24 16:04:51 +02:00
Houtan Bastani 9968f5c971 fix bug in JSON output: JSON values that are decimals must be preceded by a 0
e.g. 0.5 is valid but .5 is not.
2018-10-23 14:00:36 +02:00
Houtan Bastani 9eaf39235e write aux_unary_op function to output 2018-10-15 12:04:53 +02:00
Houtan Bastani 55b625b016 undiff expansion of var_expectation 2018-10-12 15:21:03 +02:00
Sébastien Villemot 1089a223c4 Clean up default constructors/destructors 2018-10-11 17:08:44 +02:00
Sébastien Villemot ac94ad906e Various fixes for silencing errors and warnings under Clang 6 2018-10-11 11:21:58 +02:00
Sébastien Villemot bcdfb43fd3 Replate DynamicModel::toStatic() by a converting constructor in StaticModel
It is therefore now possible to write:

  static_model = static_cast<StaticModel>(dynamic_model);
2018-10-10 17:08:54 +02:00
Sébastien Villemot 0e7d831e6f Remove redundant private keyword 2018-10-10 17:08:10 +02:00
Sébastien Villemot 52ce0d8ba9 Fix bug with discretionary_policy
Since, in this case, there are less equations than endogenous, the
variable_reordered structure was not filled with enough element, leading to an
invalid memory read when printing M_.state_var.

Ref #637
2018-10-10 17:08:01 +02:00
Sébastien Villemot 63a5ffb761 Rename ExprNode::cloneDynamic into ExprNode::clone, for clarity 2018-10-10 13:08:11 +02:00
Sébastien Villemot 24f1276b42 Make all DataTree::*_map private
Introducing a new DataTree::getVariable() const method was necessary in the process.
2018-10-10 13:03:52 +02:00
Sébastien Villemot f2cf86b734 Add copy constructors / assignment operators for the DataTree class hierarchy
In particular, it is necessary to turn back DataTree::AddVariable() into a
non-virtual method, because it is called from DataTree's constructor. Enforcing
the absence of leads/lags is now done using a new boolean DataTree::is_static.

Take advantage of the new copy constructor for handling
PlannerObjectiveStatement more elegantly.

Unfortunately it is not possible to implement *move* constructor / assigment
operators, because the reference ExprNode::datatree is not mutable.
2018-10-10 12:53:55 +02:00
Sébastien Villemot 215283005e No longer store symbol type in VariableNode
This facilitates switching variable types on the fly. In particular, this
allows removing the hack in DynamicModel::updateAfterVariableChange() that way
basically recreating all the nodes after the type change.
2018-10-10 12:34:05 +02:00
Sébastien Villemot c47b6e6e4c Fix bug with notmpterms option
Commit c6cb9aa1b8 was not the right fix.
2018-10-05 17:14:27 +02:00
Sébastien Villemot 9043efab32 Replace "class" by "typename" in template declarations 2018-10-04 18:08:19 +02:00
Sébastien Villemot 6d26dc2349 Remove implicitly-defined copy/move constructors/assignments in several classes 2018-10-04 18:08:17 +02:00
Sébastien Villemot 7bb5382428 Always use brace-initializer in constructors
The syntax makes clearer the distinction between a function call and an
initialization. Also, it prevents bugs due to implicit type conversions.
2018-10-04 17:19:18 +02:00
Sébastien Villemot a4aefb4c65 Mark all constructors taking a single argument as "explicit"
For a rationale, see http://www.sjbrown.co.uk/2004/05/01/always-use-explicit/
2018-10-04 17:19:18 +02:00
Stéphane Adjemian (Charybdis) ec872e63fd
Cosmetic change. 2018-10-04 16:54:57 +02:00
Sébastien Villemot 38f13eb0ad Remove nonsensical check on MS Visual C++ version
The check is done at the time the preprocessor is compiled, but it ought to be
done at the time when the C source file generated by the preprocessor is compiled…

Anyways, it is probably irrelevant now, since MSVC has supported
acosh/asinh/atanh for a long time now.
2018-10-02 18:23:39 +02:00
Sébastien Villemot 48940ff899 Convert SvarRestrictionType into a class enum 2018-10-02 18:15:31 +02:00
Sébastien Villemot 3f26933f44 Replace ExternalFunctionSetOrNot enum by integer constants
This was not conceptually an enum, but rather a collection of unrelated
constants:
- two constants for use as placeholder for symbol IDs at different places
- one constant for the default number of arguments
2018-10-02 18:10:12 +02:00
Sébastien Villemot 5e6b8f0a6b No longer test for __MINGW32__ macro, testing for _WIN32 is enough
Closes: Dynare/dynare#1315
2018-10-02 16:50:07 +02:00
Sébastien Villemot 15d026e54e C output: split generated function into several smaller subfunctions
This mimicks the structure of M-functions (though the logic for filling the
temporary terms vector is a bit different).

This change implied a modification in the way we compute the checksum in case
of block decomposition (the temporary terms for the C output are not correctly
computed in that case).
2018-10-01 16:04:01 +02:00
Sébastien Villemot 42e31ad6e1 Ensure that linear_decomposition is false by default 2018-10-01 10:52:19 +02:00
Sébastien Villemot 1f987706a9 Remove spurious executable permission 2018-09-28 15:25:09 +02:00
Sébastien Villemot 5e2c2fa7b6 Merge branch 'remots/mytarget/non_linear_decomposition' into 'master'
Adds a new model option "linear_decomposition" that creates a block composed of…

See merge request Dynare/preprocessor!1
2018-09-28 12:57:26 +00:00
Ferhat Mihoubi 139e3efa82 Adds a new model option "linear_decomposition" that creates a block composed of the non-linear equations o the model 2018-09-28 14:54:52 +02:00
Michel Juillard 680fb72d0d allowing for different number of periods in conditional_forecast_path 2018-09-27 15:19:30 +02:00
Houtan Bastani 63a334cfd3 fix typo 2018-09-27 10:47:13 +02:00
Sébastien Villemot c6cb9aa1b8 Fix bug in option notmpterms with model local variables
Since model local variables are now treated as temporary terms, they must be
marked as such even when option notmpterms is present.
2018-09-25 15:57:56 +02:00
Houtan Bastani fbeae9619a aesthetic fix 2018-09-25 15:48:05 +02:00
Houtan Bastani 7282b7bf32 fix bug in filling of var AR matrix 2018-09-25 15:47:52 +02:00
Houtan Bastani 6c7d7f5d44 don’t create file if trend_component_model/var_model statement not present 2018-09-25 12:18:52 +02:00
Sébastien Villemot 913bc2f8c2 Macro-processor, comprehension: fix error message, add comments 2018-09-24 18:17:28 +02:00
Sébastien Villemot 3e5c8dd80d Macro-processor: implement comprehensions
Due to a limitation of the current implementation, this breaks syntaxes like
[ (i,j) ] (but not [ (2,j) ]; the problem only occurs when an array is
constructed by specifying as first element a tuple whose first element is a
variable name). Solving this problem requires an overhaul of the
macro-processor, with construction of ASTs at parsing time, and evaluation
later on (instead of doing on-the-fly evaluation).

Ref #5
2018-09-24 18:00:59 +02:00
Sébastien Villemot 7a5cc7e54b Minor fixes to comments 2018-09-18 19:12:25 +02:00
Houtan Bastani c9f5cef99b write AST in JSON 2018-09-18 17:48:04 +02:00
Houtan Bastani 8ec06dddc4 fix typo and remove unnecessary braces 2018-09-18 17:31:51 +02:00
Houtan Bastani 9f9c8fdfbf fix typo 2018-09-18 14:50:54 +02:00
Houtan Bastani 85dbb649b7 move trend_component_table and var_model_table to DynamicModel as they are only used there 2018-09-14 17:04:06 +02:00
Houtan Bastani eb74d48393 trend_component_model: replace `trends` option with `targets` 2018-09-13 12:21:23 +02:00
Houtan Bastani dfb0629c25 fix typo 2018-09-12 18:21:34 +02:00
Houtan Bastani dc9ecbb49a fix bug in columns of EC matrix 2018-09-12 17:56:30 +02:00
Houtan Bastani 0376f7f173 fix bugs in creation of AR/EC matrices 2018-09-12 11:57:14 +02:00
Houtan Bastani aa120abd02 simplify code 2018-09-12 11:57:14 +02:00
Sébastien Villemot a95cf8118c CI: put the build job in the build stage 2018-09-11 21:00:54 +02:00