– print the information only for the final matching (and not the intermediary
ones that may have failed);
– print the equation name next to its number.
In an “evaluate” block, the LHS of a renormalized equation (such as “log(x)=…”)
could be associated to a temporary term that would then be incorrectly
computed: that temporary term would be evaluated *before* (and not after) the
evaluation of the associated variable (“x” in the example).
Should have no impact though, since diff nodes are already substituted out at
that point. But it’s better to implement it properly, in case we change the
substitution rules later.
By the way, make the computeSubExprContainingVariable method protected.
The previous system would spawn as many threads as there are object files to be
compiled (which could lead to hundreds of threads for large block-decomposed
models). This could pose a memory usage problem (even when not just waiting,
threads require memory for their own stack).
– DataTree::packageDir() now takes a std::string_view, returns a
std::filesystem::path, and no longer creates that directory
– DataTree::writeToFileIfModified() now takes a std::filesystem::path as
argument
– Do not call DataTree::writeToFileIfModified() for generating MATLAB/Octave
files, since it does not work (the directory inside which the file is written
has been deleted by the preprocessor just before)
– Consistently use DataTree::packageDir() everywhere (for compatibility with
planner_objective)
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).
Currently two threads are used (one for the dynamic MEX, one for the static
MEX). When the sparse representation is implemented, four threads will be used.
Closes: #41
This is unsafe since the find() method can return a past-the-end iterator,
which should be tested for.
Replace most instances by calls to the std::map::at() method (which throws if
the key is unknown), and which is incidentally more readable.
Elements of params_derivatives could be accessed without them being defined,
thus causing illegal memory read.
Ensure that these elements always exist. By the way, use std::map::at() instead
of std::map::find() to trigger an exception instead of an illegal memory read
in that case.
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).
When computing the derivatives or block decomposition of the planner objective,
the epilogue or the original Ramsey model, the preprocessor would talk about
dynamic/static model, which was confusing. It now uses the right terminology.
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.