Commit Graph

55 Commits (master)

Author SHA1 Message Date
Sébastien Villemot d463607e90
Reformat C++ source code using clang-format 15 2023-11-30 15:58:32 +01:00
Sébastien Villemot ac35ef6101
Error out if an “initval” block appears after an “endval” block (without the “learnt_in=…” option)
Closes: #104
2023-11-14 14:28:30 +01:00
Sébastien Villemot 9b50a8a159
Rename ys0_ into oo_.initial_steady_state and ex0_ into oo_.initial_exo_steady_state 2023-10-23 17:33:49 +02:00
Sébastien Villemot f179ec4dac
Use __builtin_unreachable() to silent some GCC warnings
This is cleaner than using exit() or assert() for that purpose.
2023-10-18 14:28:59 -04:00
Sébastien Villemot 613a8578ee
InitvalFileStatement: call histval_initvalf.m directly instead of initvalf.m wrapper 2023-10-11 16:52:04 -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
Sébastien Villemot 253fbbe7d6
Use std::filesystem::path in more places 2023-01-05 17:21:28 +01:00
Sébastien Villemot 895a866bb3
Optimization: use move semantics in more places 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 c3fc5b1dd7
Enable -Wunused-parameter
As a consequence, add many [[maybe_unused]] attributes for legitimate
cases (mainly in virtual functions).
2022-06-24 17:11:48 +02:00
Sébastien Villemot c94dfb848c
C++20 modernization: use initialization within range-based for loop
In particular, use this feature in many loops which feature a special treatment
for the first iteration, using a boolean variable (replacing iterator
manipulation). By the way, also use std::exchange() to simultaneously test the
value of this variable and update it.
2022-06-07 14:35:59 +02:00
Sébastien Villemot 0b5c88109f
Various simplifications 2022-06-07 14:34:30 +02:00
Sébastien Villemot fb3b1c301f
endval(learnt_in=…) block: fix treatment of unused endogenous variables 2022-05-06 12:56:24 +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 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
Stéphane Adjemian (Charybdis) c56d58822e
Get the value of periods returned by the initval_file command. 2022-01-21 16:43:46 +01:00
Sébastien Villemot b51f122e59
With nostrict, really ignore unused endogenous in initval/endval/histval
Closes: #82
2021-11-19 17:49:57 +01:00
Sébastien Villemot 5cfe6303e2
Cosmetic changes 2021-07-22 16:49:59 +02:00
Sébastien Villemot 74ef3457b4
Use secure URL for link to GNU licenses 2021-06-09 17:21:00 +02:00
Sébastien Villemot c2d47fb48e
Julia: remove driver file
The Julia code now uses the JSON output for retrieving the information that
previously was in the driver file.
2021-04-19 17:02:41 +02:00
MichelJuillard 6662d8014e
fix writeJsonOutput for load_params_and_steady_state 2021-04-01 17:05:13 +02:00
MichelJuillard ed4c36a267 add first_simulation_period to the lexer
(cherry picked from commit c8575e11d2f81ad606ab50849c52127653699a93)
2020-05-14 14:36:35 +00:00
Sébastien Villemot c4a9f93d40
Do not allow the estimation of a parameter that appears in “planner_discount”
Ref. dynare#1173
2020-02-04 17:49:53 +01:00
Sébastien Villemot e2d5a83592
Global reindentation 2019-12-20 16:59:30 +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 031c0cff5f
Various code simplifications and modernizations 2019-12-16 19:42:59 +01:00
Houtan Bastani 0ff7a9d2ab
introduce command line options: `exclude_eqs` and `include_eqs`
Allows for the inclusion/exclusion of a set of equations, specified either on the command line or in a text file.

If the equation has a single endogenous variable on the LHS, then the equation is moved. If not, if the equation has an `endogenous` tag then that variable is removed along with this equation. If not, then an error is thrown.

As a command line argument, `exclude_eqs` can take the form (same syntax for `include_eqs`):
* `exclude_eqs=eq1 to remove all equations declared as `[name=eq1]`
* `exclude_eqs=[eq 1, eq 2]` to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`
* `exclude_eqs=[tagname=X]` to remove all equations declared as `[tagname=X]`
* `exclude_eqs=[tagname=(X, Y)]` to remove all equations declared as `[tagname=X]` or `[tagname=Y]`

When declared in a file, the file should be of the form:
```
eq 1
eq 2
```
to remove all equations declared as `[name=eq 1]` or `[name=eq 2]`.

It should be of the form:
```
tagname=
X
Y
```
to remove all equations declared as `[tagname=X]` or `[tagname=Y]`.
2019-11-26 14:16:00 +01:00
Sébastien Villemot d839aea08b
Drop unused functions for writing C and C++ output
These functions should have been deleted in
946d105c04.
2019-10-24 10:54:46 +02:00
Sébastien Villemot 2c6fa34a1f
C++17: use structured bindings instead of std::tie whenever possible 2019-09-11 16:40:19 +02:00
Sébastien Villemot deb41a2a8f
Fix comment in previous commit 2019-07-11 18:39:32 +02:00
Sébastien Villemot e7b619c0ef
Fix handling of underflows and overflows in load_params_and_steady_state
Basically revert the change made in 30c205f418,
since it lead to preprocessor crashes (via C++ exceptions).
2019-07-11 18:35:42 +02:00
Sébastien Villemot b73d554ad2
Use Unicode copyright symbol (in UTF-8 encoding) 2019-04-16 11:35:31 +02:00
Sébastien Villemot 8a41a75c85
Apply modernize-raw-string-literal from clang-tidy
Use ReplaceShorterLiterals option to enforce replacement of all strings.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html
2019-04-03 16:45:52 +02:00
Sébastien Villemot 78583135df
Use true/false instead of 1/0 for boolean options
This is more elegant, and makes it easier to distinguish them from integer
options.
2019-03-19 15:15:10 +01:00
Sébastien Villemot 3d42e6468d
Octave compatibility fix 2019-02-25 16:56:11 +01:00
Houtan Bastani 9c95bfa33f
fix typos 2019-01-18 12:48:45 +01:00
Houtan Bastani 027b59b449
fix typos 2019-01-18 12:36:19 +01:00
Sébastien Villemot f2b0bdf0a2
Fix bug when histval is used and there is no auxiliary variable
Problem introduced in a69c65361c.
2018-12-20 17:45:54 +01:00
Sébastien Villemot b2e3a481e3
Fix for histval with auxiliary lead variables corresponding to non-linear terms
The M_.params structure was not correctly passed to
dynamic_set_auxiliary_series.m, leading to crashes if a parameter was needed to
compute an auxiliary variable (typically an auxiliayr lead variable
corresponding to a non-linear term in stochastic setup).
2018-12-20 15:05:18 +01:00
Sébastien Villemot a69c65361c
Fix ramsey_policy with histval
Since 38152c34a4, the M_.endo_histval variable is
generated via dynamic_set_auxiliary_dseries.m. But the latter file does not
handle auxiliary variables for Lagrange multiplier. We therefore now set them
by hand (at an initial value of zero).
2018-12-20 15:05:18 +01:00
Sébastien Villemot 9e66627375
Fix for histval block in the presence of auxiliary lead variables
Since 38152c34a4, the M_.endo_histval variable is
generated via dynamic_set_auxiliary_dseries.m. The problem is that, for
auxiliary variables corresponding to a lead, this will generate a NaN in
M_.endo_histval. This is conceptually correct, since such variables are never
used as initial conditions, but this is inconsistent with what we do with the
"initval" block, and leads to crashes in some routines where we fail when there
is a NaN. Therefore, replace these with a zero, as it used to be.
2018-12-20 15:05:17 +01:00
Sébastien Villemot 38152c34a4
Make histval compatible with diff operator
The idea is to make use of the dynamic_set_auxiliary_dseries.m file to generate
the initial conditions for all auxiliary variables, including the diffs.

Also remove the check done by the preprocessor for the lags in histval, since
it does not work correctly with the diff operator.
2018-12-11 17:32:05 +01:00
Sébastien Villemot a08ce3de2b
Yet more simplifactions using std::tuple 2018-12-03 16:07:13 +01: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 d6055c1407 C++11: convert SymbolType to a class enum 2018-07-17 18:55:26 +02:00
Sébastien Villemot 30c205f418 C++11: replace calls to std::atof() by std::stod() 2018-07-04 14:53:13 +02:00
Sébastien Villemot 988a9f6e2d std::open and std::fstream constructor accept a std::string for filename in C++11 2018-06-27 15:30:45 +02:00
Sébastien Villemot 1e56c73377 Port to C++11 nullptr keyword
Performed using modernize-use-nullptr from clang-tidy.

https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2018-06-04 15:03:31 +02:00