Commit Graph

111 Commits (master)

Author SHA1 Message Date
Sébastien Villemot 520876560d
New matched_irfs and matched_irfs_weights blocks
Closes: #124
2023-12-19 16:10:19 +01:00
Sébastien Villemot 0f397f40af
Rename “dynare_sensitivity” command to “sensitivity”
The old name is still accepted, but will trigger a deprecation warning.
2023-12-14 18:37:10 +01:00
Sébastien Villemot b2e9ec205e
No longer use reserved identifiers for include guards
Automatically detected using clang-tidy with bugprone-reserved-identifier
check.

By the way, homogeneize the define identifiers in relation to camel case
convention.
2023-12-01 15:39:01 +01:00
Sébastien Villemot 7e6abc97c4
Add [[nodiscard]] attribute to various functions
Automatically detected using clang-tidy with modernize-use-nodiscard check.
2023-12-01 14:14:44 +01:00
Sébastien Villemot d463607e90
Reformat C++ source code using clang-format 15 2023-11-30 15:58:32 +01:00
Sébastien Villemot 46aa6610ab
model_replace, model_remove: allow selecting an equation with several (conjunct) tags
NB: does not (yet) works with Occbin regime-specific equations.

Ref. dynare#1890
2023-11-15 12:05:06 +01:00
Sébastien Villemot 1ad7dd9672
Refactor parsing of equation tags in a more functional way
Incidentally, makes tag names case-insensitive in “model_replace” and
“model_remove”, which is consistent with tag declarations.
2023-11-14 15:55:30 +01:00
Sébastien Villemot f78c428d99
New option “relative_to_initval” to “mshocks” block 2023-10-18 16:16:41 -04:00
Sébastien Villemot 6af84b8cac
The “mshocks” block now accepts the “learnt_in=…” option 2023-10-17 15:59:10 -04:00
Sébastien Villemot 6ec7f580d5
New option “static_mfs” to “model” block (and “model_options” command)
Currently defaults to 0.
2023-10-16 11:50:26 -04:00
Sébastien Villemot 084372a314
Add new option “from_initval_to_endval” to “homotopy_setup” block 2023-10-10 10:20:21 -04:00
Sébastien Villemot a4bc539364
Rename HomotopyStatement class to HomotopySetupStatement
For consistency with other such classes, since it represents the homotopy_setup
block.
2023-10-06 16:51:39 -04:00
Johannes Pfeifer 27a3a559e4
Move BVAR to +bvar folder 2023-09-14 11:59:06 +02:00
Sébastien Villemot 8ebd9a9496
Drop the “Sigma_e” statement 2023-01-16 15:08:23 +01:00
Sébastien Villemot a7b0a324c9
Drop the “periods” statement 2023-01-16 15:02:50 +01:00
Sébastien Villemot 198ff70bce
Simplify strsplit() using std::string_view
By the way:
– improve the semantics by having a consistent treatment of empty substring
  components (previously, only the last one was ignored)
– move it to DataTree to make it more accessible from elsewhere (even though
  ideally it should be in a “utilities” namespace).
2022-10-11 16:23:11 +02:00
Sébastien Villemot 5c33051990
Use std::string_view in a few places where it makes sense 2022-10-04 16:47:16 +02:00
Sébastien Villemot 895a866bb3
Optimization: use move semantics in more places 2022-10-04 16:00:30 +02:00
Sébastien Villemot d67f569035
Always compute block decomposition, even if “block” option was not passed
If block decomposition fails, error out if “block” option was passed, but not
otherwise.

This commit does not modify the generated files.

This is a preliminary step for dynare#1859.
2022-09-13 16:16:00 +02:00
Sébastien Villemot 46b2c73565
C++17 modernization: more uses of std::optional 2022-06-08 12:34:25 +02:00
Sébastien Villemot 3516894a71
JSON output: fix handling of vector value options
The vectors were previously stored as strings internally, which would not
necessarily contain the commas which are required in JSON (but not in
MATLAB/Octave). The fix consists in internally storing those options as
std::vector.

Closes: #96
2022-05-18 17:44:36 +02:00
Sébastien Villemot 2795207802
No longer delete move constructor/assignment operator
We follow the advice given by Josuttis in his book about move semantics.

Deleting those member fuctions can be a bug if we want to allow copy semantics,
because overload resolution will no longer fallback to the copy
constructor/assignment operator when given an rvalue.

In particular, this explain why it was not possible to delete the move
assignment operator of the StaticModel class.
2022-05-18 16:33:48 +02:00
Sébastien Villemot 8fd1505ca2
C++17 modernization: use std::optional for “periods” option of “plot_conditional_forecast”
Incidentally, in the JSON output, no longer assign a value to the “periods”
field if not passed by the user (previously the value -1 was output in the JSON
file).
2022-05-16 19:10:15 +02:00
Sébastien Villemot 3a820fffa2
New += and *= syntaxes in “endval(learnt_in=…)” blocks
Incidentally, forbid exogenous deterministic variables in “endval” blocks.
2022-05-03 16:52:04 +02:00
Sébastien Villemot 76a16a69a8
New “add” and “multiply” keywords in “shocks(learnt_in=…)” block 2022-04-26 15:21:45 +02:00
Sébastien Villemot 8e3590ee71
Reject exogenous deterministic variables in a few places where they were erroneously accepted
– heteroskedastic_shocks block
– generate_irfs command
– new estimation syntax
2022-04-21 17:59:04 +02:00
Sébastien Villemot b5a4df1608
New shocks(learnt_in=…) and endval(learnt_in=…) blocks
For use with perfect_foresight_with_expectation_errors_setup.
2022-04-21 17:07:33 +02:00
Sébastien Villemot 71edfd05e4
Add new “log” option to “var” statement
When an endogenous is declared with “var(log)”, say “y”:
– creates an auxiliary named “LOG_y”
– replaces “y(±l)” everywhere by “exp(LOG_y(±l))”
– adds a new auxiliary equation “y=exp(LOG_y)”
– adds a new definition “LOG_y=log(y)” in set_auxiliary_variables.m and
  dynamic_set_auxiliary_series.m files

This option also works in conjunction with “deflator=…”, such as “var(log,
deflator=…)” (the “log” must appear befor “deflator”). There are no provisions
for combining “log” with “log_deflator”, because that would not make much sense
from an economic point of view (amounts to taking the log two times).

Ref. dynare#349
2022-03-30 17:46:07 +02:00
Sébastien Villemot ee14027e1b
Remove duplicate functions for setting current parser data tree to dynamic model 2022-03-30 17:27:08 +02:00
Sébastien Villemot 40398425ae
Refactor some symbol declaration helpers so that they return the symbol ID
This avoids useless calls to SymbolTable::getID().
2022-03-29 16:44:04 +02:00
Sébastien Villemot 46cc47266b
Refactor parsing of symbol lists
For symbol lists (such as those given to “var” or “stoch_simul”), return a
semantic value at the Bison level, rather than building the list through a
temporary object in ParsingDriver. This allows various simplifications, and
leads to a more functional code.

By the way, homogeneize the naming of the various flavours of symbol lists in
the Bison file (with TeX names, partitioning, or with a wildcard).
2022-03-29 14:59:34 +02:00
Sébastien Villemot 9db21a231c
Handle “resid” command at the preprocessor level and add “non_zero” option 2022-03-01 14:23:18 +01:00
Sébastien Villemot 17c5e1935d
Fix error message when “ramsey_policy” follows a “ramsey_model” statement
By the way, also fix error message when there are several “ramsey_model” or
“ramsey_policy” statements.

Closes: #90
2022-02-21 16:45:56 +01:00
Sébastien Villemot a8fce06dc4
PAC: new options “auxname” and “kind” to “pac_model” 2021-12-16 15:40:47 +01:00
Sébastien Villemot ea6fb40db7
PAC: new “pac_target_info” block and “pac_target_nonstationary” operator
Ref. Madysson/estimation-codes#5
2021-12-16 15:40:47 +01:00
Sébastien Villemot ea44aa19d6
New option “overwrite” to “estimated_params” block
This option provides the same behaviour as before the change in
60ef6bbdbd.

It is typically useful when doing several estimations in the same .mod file.
2021-12-16 14:22:31 +01:00
Sébastien Villemot 5ffbc5bad3
New estimated_params_remove statement 2021-12-15 16:02:57 +01:00
Sébastien Villemot 342c4faf8d
New var_remove statement 2021-12-15 12:20:29 +01:00
Sébastien Villemot 1f004584e9
New model_remove statement and model_replace block
Factorize the implementation with the existing code for the include_eqs and
exclude_eqs options (which has been refactored by the way).

Ref. #19
2021-12-15 12:11:25 +01:00
Sébastien Villemot d15b2110a0
Add erfc() primitive
Closes: #85
2021-12-07 15:19:40 +01:00
Sébastien Villemot 1de3476546
Macroprocessor: fix line counter inside @{} constructs
There were two bugs:
– with the LF convention, newlines were counted twice
– with the CR+LF convention, they were counted four times (because the CR was
  included in yyleng, alongside the LF)

The fix consists in implementing a location_increment() method similar to the
one used for the Dynare parser. This is the most robust solution.

By the way, mark the method DynareFlex::location_increment() method static.
2021-11-19 14:55:14 +01:00
Sébastien Villemot 0123326123
Fix error message when using pac_expectation with occbin_constraints
By the way, also fix the argument name (the model is not a VAR).
2021-10-29 14:11:08 +02:00
Sébastien Villemot eb006ecaeb
Remove unused steady_state_growth option to pac_model 2021-09-22 16:26:42 +02:00
Sébastien Villemot 15d7432105
Occbin: add more sanity checks on expressions in “occbin_constraints” block
— forbid leads and lags
— forbid expectation operators

This is implemented by moving the occbin_constraints expression to a separate
DataTree. As a side-effect, this removes the spurious non-linearity warning in
a stochastic context (because we were introducing inequalities and abs()
operators in the main DynamicModel tree).
2021-07-21 16:33:23 +02:00
Sébastien Villemot ebd9954d33
Occbin: new syntax for constructing multi-regime equations
Ref. #68
2021-07-20 18:18:24 +02:00
Sébastien Villemot 81d4fd5d83
Occbin: generate +<basename>/occbin_difference.m
In particular, this implies that steady state values of endogenous in the
“occbin_constraints” block must now be specified using the STEADY_STATE()
operator (and not with a “_ss” suffix).

Moreover:
– make various simplifications to the fields generated under M_
– in the driver file, replace the call to occbin.initialize() by a few explicit operations

Ref. #68
2021-07-20 12:26:11 +02:00
Sébastien Villemot 08ac455fcd
Implement “occbin_constraints” block
Consequently drop “occbin” option to “model”.

Incidentally, allow more values in equation tag names (previously some keywords
such as “alpha” were disallowed).

Ref. #68
2021-07-16 11:34:27 +02:00
Sébastien Villemot 2e696a2e0d
Add shocks(surprise) block (for occbin)
Ref. #68
2021-07-13 21:55:31 +02:00
Johannes Pfeifer 61b37942ab First part of Occbin interface 2021-07-13 13:38:25 +00:00
Sébastien Villemot 6aeef11bb2
New perfect_foresight_with_expectation_errors_{setup,solver} commands 2021-07-09 17:14:22 +02:00