Commit Graph

2529 Commits (ebafd8f3b6747850c32fd56560946d9fd6a47919)

Author SHA1 Message Date
Sébastien Villemot ebafd8f3b6
Epilogue: always initialize M_.epilogue_names and M_.epilogue_var_list_
Ref. dynare!1688
2019-12-20 11:47:54 +01:00
Stéphane Adjemian (Charybdis) 8baec1e0ec Allow k order estimation.
Automatically switch to k_order_solver if order>2. Use old mex file if
order==2 (since it seems unexpectedly significantly faster than
local_state_space_iteration_k, and because it can deal with pruning).
2019-12-20 11:15:16 +01:00
Sébastien Villemot d441ff059a
Fill the “M_.aux_vars(:).orig_expr” field for all auxiliary variables
This field contains a string representation of the expression that the
auxiliary variable replaces.

It is non-empty for all auxiliary variables, except for Lagrange multipliers.

Ref. dynare#773
2019-12-19 16:58:26 +01:00
Sébastien Villemot 8b23a2d575
Fix incorrect static model when “diff” operator is present
The “diff” operator was incorrectly replaced by its argument in the static
model, leading to an incorrect result for the steady state.

This is because the information contained in the “expr_node” field of the
auxiliary variables storage was not consistent across all types of auxiliary
variables: for a “diff()” operator, it would contain the argument of the
operator, instead of the full node. Hence it would not simplify to zero at the
steady state.

A similar inconsistency was also present for the “expectation()” operator,
though it was not leading to an incorrect static model.
2019-12-19 16:50:40 +01:00
Sébastien Villemot 044258b0a2
Make “datafile” option of “perfect_foresight_setup” (and “simul”) equivalent to “initval_file”
Ref. dynare#1663
2019-12-19 14:53:52 +01:00
Sébastien Villemot d1d244086d
Remove spurious spaces within parentheses in generated MATLAB code 2019-12-18 17:35:25 +01:00
Sébastien Villemot fe0c781c06
New “planner_discount_latex_name” option of “ramsey_policy”
Accepts a TeX name, as for variable declarations (i.e. enclosed within dollar
signs).

Ref. dynare#1686
2019-12-18 17:32:41 +01:00
Sébastien Villemot 1a08cdf01a
BinaryOpNode::findConstantEquations(): fix bug related to nested if/else
In the absence of braces, the last “else” clause is always associated with the
closest “if”, which is not what was intended here. The indentation was
misleading.
2019-12-18 16:32:59 +01:00
Houtan Bastani a4ef5a01d3
Epilogue: handle case where `dseries.firstobservedperiod` ends in an error
issue #36
2019-12-18 15:54:50 +01:00
Houtan Bastani 4f20b1146e
Epilogue static file: handle case where RHS is not a dseries
issue #36
2019-12-18 15:50:37 +01:00
Houtan Bastani e2d9e179a2
Include missing header 2019-12-18 15:43:49 +01:00
Houtan Bastani 86c79250cf
Make iterator const 2019-12-18 15:43:49 +01:00
Houtan Bastani 653b2477db
Update for bison 3.5 2019-12-18 15:43:48 +01:00
Houtan Bastani 87870eaae8
Epilogue: remove +1
issue #36
2019-12-18 15:43:48 +01:00
Houtan Bastani efb2752e4e
Ramsey: fix bug: symbol_list is not passed to RamseyPolicy statement when it was not passed options 2019-12-18 12:07:59 +01:00
Sébastien Villemot c2461981d2
Various provisions for improvements to shock decomposition commands
– New “squeeze_shock_decomposition” command
— New “max_nrows” option to “plot_shock_decomposition” and
  “initial_condition_decomposition”
— “plot_shock_decomposition” now returns oo_ as an output argument

Ref. dynare#1687, dynare!1655
2019-12-18 11:39:44 +01:00
Sébastien Villemot 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Sébastien Villemot 97fa005b33
Use 1-based indexing in M_.nonzero_hessian_eqs 2019-12-13 22:31:49 +01:00
Sébastien Villemot 141cff0761
New field M_.endo_trends
For each endogenous variable, gives the deflator and the growth factor (as well
as the “log” versions).

Ref. dynare#1648
2019-12-13 18:02:37 +01:00
Sébastien Villemot 2af26ee2c2
Ramsey: use information from transformed model for filling M_.nonzero_hessian_eqs
Since commit 9c9e8f816f, it’s the information
from the original model which was in this field, which is not what is expected.

By the way, do not output this field (and the related M_.hessian_eq_zero) when
the Hessian is not computed by the preprocessor (i.e. in practice for perfect
foresight), since they would otherwise contain incorrect information.

Ref. dynare#1681
2019-12-13 18:02:35 +01:00
Houtan Bastani 2646f01424
fix quotes from 7958f76fae 2019-12-13 16:03:37 +01:00
Houtan Bastani fddfb7fe2f
Issue deprecation warning for `simul`
closes dynare#1683
2019-12-13 16:01:47 +01:00
Houtan Bastani c1b8cdf811
epilogue: simplify _static file
issue #36
2019-12-12 16:32:12 +01:00
Sébastien Villemot b58bbb8e84
Ramsey: do not warn if instruments are not defined in steady_state_model block
Closes: dynare#1677
2019-12-12 16:19:15 +01:00
Sébastien Villemot 047b397899
Simplify x+y-y in x
Note that this actually corresponds to 4 different abstract syntax trees:
— (x+y)-y
— (y+x)-y
— (x-y)+y
— y+(x-y)
2019-12-12 16:19:15 +01:00
Sébastien Villemot d747b53a8b
Simplify x*y/y in x
Note that this actually corresponds to 4 different abstract syntax trees:
— (x*y)/y
— (y*x)/y
— (x/y)*y
— y*(x/y)
2019-12-12 16:19:15 +01:00
Sébastien Villemot 50275f3588
Simplify x-(-y) in x+y 2019-12-12 16:19:15 +01:00
Sébastien Villemot f24f28b2b2
Simplify x/(1/y) in x*y 2019-12-12 16:19:15 +01:00
Sébastien Villemot 1d3265acb7
C++17: further code simplifications (assignments in if) 2019-12-12 16:19:14 +01:00
Houtan Bastani 44adcbb488
epilogue: replace `dseries__` with `ds` making the file easier to read 2019-12-12 14:46:45 +01:00
Houtan Bastani dfcd381d20
epilogue: fix bug with external functions in `epilogue` block
issue #36
2019-12-12 14:45:49 +01:00
Houtan Bastani 7958f76fae
issue deprecation warning for `ramsey_policy`
dynare#1678
2019-12-12 11:36:43 +01:00
Houtan Bastani 8dfa79a0f5
new command `evaluate_planner_objective`
dynare#1678
2019-12-12 11:35:26 +01:00
Houtan Bastani 5430bb4bc6
simplify for statement 2019-12-11 16:21:18 +01:00
Houtan Bastani 4111bc8cfc
epilogue: create _dynamic and _static files
#36
2019-12-11 16:17:54 +01:00
Houtan Bastani 34a41b557d
epilogue: output endogs used in epilogue equations
#36
2019-12-11 15:51:26 +01:00
Houtan Bastani 41d38551e5
write names of epilogue variables 2019-12-11 15:51:26 +01:00
Houtan Bastani 3694fc40b3
detrend epilogue equations 2019-12-11 14:45:47 +01:00
Houtan Bastani 8dc70602c8
macro processor: move evaluation of all arguments for unary, binary, and trinary ops into their switch cases 2019-12-10 16:33:32 +01:00
Houtan Bastani 952e899f3a
fix bug in macro processor ensuring short-circuit functionality of `||` and `&&` statements
closes dynare#1676
2019-12-10 16:30:11 +01:00
Sébastien Villemot 5c081db76f
Add option “colormap” to “initial_condition_decomposition” command.
Ref dynare#1586
2019-12-09 15:43:39 +01:00
Sébastien Villemot 8962a9d589
Windows: apply the workaround for +<basename> removal to +objective subfolder
Because MATLAB under Windows maintains a lock on the “+<basename>” subdirectory,
we use a workaround consisting in first renaming the directory, then deleting
it.

But this is not enough when the “ramsey_policy” command is used, because the
latter creates a “+objective” subfolder inside “+<basename>”, on which MATLAB
also maintains a lock.

The fix consists in recursively using the same workaround as for the top-level
directory: renaming before deleting.
2019-12-06 15:19:23 +01:00
Houtan Bastani 3f3ef7ca00
fix bugs in initial_condition_decomposition statement
closes #37
2019-12-06 10:40:44 +01:00
Sébastien Villemot b5b0099064 Merge branch 'compiler' into 'master'
add compiler statement

See merge request Dynare/preprocessor!11
2019-12-04 16:00:50 +00:00
Houtan Bastani 2814f05a67
Add flag to compilation of flex file
Without this flag flex errors out because it hits a hard-coded size limit
2019-12-04 16:57:20 +01:00
Houtan Bastani 02cb4cc973
add compiler statement
Allows the user to set the compiler, flags, and libs to be used with `use_dll`

Issue #35
2019-12-04 16:57:20 +01:00
Houtan Bastani bf56d6fb82
fix LaTeX output for sqrt, exp, sin, cos, tan 2019-12-04 11:26:30 +01:00
Houtan Bastani 2db2133796
fix bugs with cbrt
- it was not handled in the model block
- output was incorrect for MATLAB/Octave and LaTeX
2019-12-04 11:10:19 +01:00
Houtan Bastani abbdbb5862
Clarify part of code 2019-12-03 16:42:38 +01:00
Sébastien Villemot 23ff36a0dd
Systematically compute recursive ordering of auxiliary equations
Auxiliary equations appearing in set_auxiliary_variables.m and
dynamic_set_auxiliary_series.m need to appear in recursive ordering, since
those files are used for sequential evaluation.

Previously, the recursive ordering was guaranteed by a set of ad hoc rules and
workarounds, but that would not cover certain edge cases.

With this commit, the recursive ordering is systematically computed, using a
topological sort on the directed acyclic graph whose vertices are auxiliary
equations and whose edges are dependency relationships.

Closes: #22
2019-12-03 14:26:13 +01:00