Commit Graph

191 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 22675728aa
No longer call std::move on trivially-copyable types
Automatically detected by clang-tidy with performance-move-const-arg check.

Do not make the modification for Tokenizer::location type, since we have no
guarantee that the type will remain trivially-copyable in the future.
2023-12-13 15:37:07 +01:00
Sébastien Villemot 7cfe226e58
When possible, use a more efficient overload of std::string::find()
Automatically detected by clang-tidy using the performance-faster-string-find
check.
2023-12-13 14:21:11 +01:00
Sébastien Villemot c5cc61b110
PlannerObjectiveStatement: turn model_tree into a std::unique_ptr
Avoids an unnecessary copy.
2023-12-01 14:59:20 +01:00
Sébastien Villemot 5e89921ea1
Use emplace() and emplace_back() at several places
Automatically detected using clang-tidy with modernize-use-emplace check.
2023-12-01 14:30:03 +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 43fc59a2bc
The “mfs” option of the “model” block no longer affects the static model
This is a restoration of the behaviour that was present in 5.x.
2023-10-16 11:49:30 -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 1b7b70ec93
Build system: enable the dangling else warning (-Wdangling-else)
Adapt the code accordingly.
2023-04-11 14:22:32 +02:00
Sébastien Villemot 62c455ff56
Misc simplifications using STL algorithms 2023-02-28 16:27:29 +01:00
Sébastien Villemot 1c813a1cf9
Run detrending engine if trend variables are present, even if unused in a var(deflator=…) statement
Closes: #113
2023-01-24 14:14:40 +01:00
Sébastien Villemot f45a99fc68
Correctly propagate “mfs” and “cutoff” to the static model
Those two settings were previously always at their default value for the static
model, independently of what the user would set in the .mod file.
2023-01-17 16:38:03 +01: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 6ed033f202
Bugfix: “relative_irf” option passed to “irf_calibration” was also passed to next command 2022-10-04 16:00:30 +02:00
Sébastien Villemot 7f1b4fcc20
Refactor OptionsList class
In particular, use a std::variant to store the values of options. This ensures
that a given option name can have only one value (previously, for a given
option name, it was possible to store several values as long as they were of
different types).
2022-09-20 11:56:43 +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 83a94aca57
Replace most uses of std::string::compare() by operator==(), for clarity 2022-07-20 11:18:20 +02:00
Sébastien Villemot 13dc0a1144
Use operator""s to replace some calls to std::string constructor
By the way, remove other unnecessary calls to that constructor.
2022-06-22 12:47:11 +02:00
Sébastien Villemot ee8ee7c27f
Optimization: use move semantics in a few more places 2022-06-13 14:27:19 +02:00
Sébastien Villemot 8541179a56
Correctly clean up options list after a “pac_model” statement 2022-06-13 14:27:19 +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 9ace2dc413
C++17 modernization: take advantage of class template argument deduction 2022-06-07 14:35:26 +02:00
Sébastien Villemot 0b5c88109f
Various simplifications 2022-06-07 14:34:30 +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 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 7bd449d6c3
C++20 modernization: use new std::erase_if function 2022-05-04 17:37:58 +02:00
Sébastien Villemot b42ee40b55
C++20 modernization: use contains() method on containers 2022-05-04 17:37:57 +02:00
Sébastien Villemot ef02b79486
Various minor simplifications 2022-05-04 17:36:59 +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 6509bc7d36
Allow “learnt_in=1” for “shocks” and “endval”
In that case, the option has no effect.
2022-04-29 11:17:11 +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 dbe14ecfd4
Add checks on the value of the “learnt_in” option of “shocks” and “endval” 2022-04-26 11:45:22 +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