Commit Graph

2132 Commits (b88e0de53febbbcfe1b7c3baeaca69e6b71b307b)

Author SHA1 Message Date
Sébastien Villemot b88e0de53f
Remove useless accessor methods for data members that are const in ExprNode classes
Those const data members are simply made public.
2018-11-28 14:35:30 +01:00
Sébastien Villemot cac65b071e
Fix visibility of matchVTCTPHelper method in subclasses of ExprNode 2018-11-28 14:18:08 +01:00
Houtan Bastani 41af0841c3
extend nopreprocessoroutput option to substitution output 2018-11-28 11:53:50 +01:00
Sébastien Villemot 16a97a96fd
Rewrite engine for matching the non-optimizing agents part in PAC
The engine is now more robust and should reject any expression that does not
conform to the expected form. It is also able to deal with more cases, such as
terms appearing with a minus sign, or variables in the middle of a
three-factors product.

BTW, use a std::tuple for storing the result of the matching inside
PacExpectationNode, and change the order of components within the
structure (variable first, scalar last).
2018-11-27 19:03:35 +01:00
Sébastien Villemot 003df49e7d
Remove useless "virtual" keyword in various ExprNode methods 2018-11-27 09:50:41 +01:00
Sébastien Villemot fa039b8c41
Fix bug in block decomposition with treatment of varexo_det 2018-11-23 17:39:18 +01:00
Sébastien Villemot d733f3fb5a
Various simplifications and modernizations of the block/bytecode part 2018-11-23 17:19:59 +01:00
Sébastien Villemot fc9cc2dc50
Output symmetric elements in derivatives of hessian w.r.t. parameters
The preprocessor now writes all the symmetric elements in the "hp"
matrix (derivatives of the hessian w.r.t. parameters), for consistency with all
other derivatives output.

Previously it was only writing one of the two symmetric elements, when indices
of endogenous were different.
2018-11-22 17:51:14 +01:00
Sébastien Villemot e3a3992c1c
Derivation engine w.r.t. parameters generalized to any order
Also, no longer compute two times symmetric elements in derivation w.r.t.
parameters at order 2, for consistency with derivation w.r.t. endogenous.
It is therefore now necessary to duplicate them in the output to keep behavior
unchanged.
2018-11-22 17:13:55 +01:00
Sébastien Villemot 6fa115aedd
Derivation engine w.r.t. endogenous generalized to any order 2018-11-22 17:13:55 +01:00
Sébastien Villemot b7d50560f8
Move ModelTree constructor up in the file for clarity 2018-11-22 17:13:55 +01:00
Sébastien Villemot dfe1a005af
Bison bug has been fixed in 3.2.2 2018-11-22 11:46:36 +01:00
Sébastien Villemot fb883bbfb0
Small simplification of Bison file
Thanks to Akim Demaille for the suggestion.
2018-11-21 14:38:06 +01:00
Sébastien Villemot f01c4f85c2
Fix Julia bug introduced in previous commit 2018-11-19 16:39:05 +01:00
Sébastien Villemot 33994dde03
Optimization for use_dll at 2nd and 3rd order
When creating the sparse matrix (in MATLAB or C mode), since storage is in
column-major order, output the first column, then the second, then the third.
This gives a significant performance boost in use_dll mode (at both compilation
and runtime), because it facilitates memory accesses and expression reusage.
2018-11-19 16:03:47 +01:00
Sébastien Villemot b524e19cde
Remove duplicate storage of temp terms for params derivs in ModelTree 2018-11-16 18:26:36 +01:00
Sébastien Villemot e9b5f239df
Properly deal with model local variables in params derivatives file
Closes #13
2018-11-16 18:26:11 +01:00
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