Commit Graph

306 Commits (3d2125287ac7a740bfac068d11357d6e1d04fa14)

Author SHA1 Message Date
Sébastien Villemot 3d2125287a
Temporary terms: various simplifications and added comments 2018-11-16 17:11:06 +01:00
Sébastien Villemot e89dd9cb8b
Make storage of derivatives ready for k-order
This is the first step towards computing k-order derivatives.

Ref Dynare/dynare#217, #10
2018-11-15 17:48:46 +01:00
Houtan Bastani 3eff2b91c2
rename ds variable in epilogue to a longer name 2018-11-15 15:04:02 +01:00
Houtan Bastani a8c7fb694b
fix typo 2018-11-15 14:48:31 +01:00
Houtan Bastani 987465365c
Revert "macroprocessor: allow inline comments. closes #1550"
This reverts commit 17dd443341.
2018-11-15 12:34:05 +01:00
Houtan Bastani eca82834a1
Revert "Fix parsing of empty strings in macro-processor"
This reverts commit 158f027db2.
2018-11-15 12:33:59 +01:00
Houtan Bastani 8e1cb261c5
Revert "only allow inline comments on statement lines. #4"
This reverts commit 3776e3b890.
2018-11-15 12:24:40 +01:00
Houtan Bastani 989532a6a2
add `string`, vec_str key/value option to posterior_sampler_options 2018-11-09 15:11:15 +01:00
Sébastien Villemot e22aa1c162
Compatibility issue with Bison 3.2 2018-11-08 15:01:43 +01:00
Houtan Bastani 5f5fd569dd
add onlymodel command line option 2018-11-07 15:35:03 +01:00
Sébastien Villemot beb99d98cd
Build system improvements for MSYS2
On Windows/MinGW, use the -static linking flag. This enforces static linking of
Boost libraries, which is needed on MSYS2.

Also, use AM_CXXFLAGS and AM_LDFLAGS variables for changing flags, since
CXXFLAGS and LDFLAGS are user variables.
2018-11-06 12:14:49 +01:00
Sébastien Villemot f223af91af
Improve the fix in 366701c094
Now both x+(-y) and (-x)+y are simplified using a minus operator.

Also simplify some code using std::swap().
2018-11-05 12:31:12 +01:00
Sébastien Villemot 366701c094
Apply x+(-y) ⇒ x-y simplification even when x and y are permuted
Incidentally, this fixes an issue in DataTree::operator=(), where this would
cause to the copy to have a different number of nodes than the original.
2018-11-05 11:28:00 +01:00
Sébastien Villemot ee5fc6b16b
Simplify parsing of options using C++ strings 2018-10-31 11:17:26 +01:00
Houtan Bastani 08caaa0744
backslashes not used in escape sequences are not allowed in strings in Julia v1.0
See: https://github.com/JuliaLang/julia/issues/21284
2018-10-30 12:14:26 +01:00
Sébastien Villemot b337a5aec0
Fix usage 2018-10-29 14:55:02 +01:00
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
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