Commit Graph

178 Commits (c3fc5b1dd799641fbbedfb420358e3dc6f5a4b87)

Author SHA1 Message Date
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 9bd2973034
Refactor bytecode output around a new BytecodeWriter class and operator<< overloads 2022-06-24 13:10:04 +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 5cd5676c8e
Bytecode: directly use several enums inside instruction classes 2022-06-20 15:19:08 +02:00
Sébastien Villemot a85730313c
Split CodeInterpreter.hh into two headers
– a generic one: CommonEnums.hh
– and a bytecode-specific one: Bytecode.hh

By the way, rename global constant “near_zero” into “power_deriv_near_zero”,
for clarity.
2022-06-16 17:53:23 +02:00
Willi Mutschler fe8aaf44fd
🍎 provisions for Apple Silicon package 2022-06-08 15:11:02 +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 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 171cd65566
Fix bytecode compilation of external function nodes 2022-05-20 11:43:02 +02:00
Sébastien Villemot 92d3b8166a
C++17 modernization: use std::optional for equation line numbers 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 54ca5d9cc0
Improve messages during model normalization
– Indicate whether we are trying to normalize the static or dynamic model
– If failed to normalize the static model, suggest to use the “no_static”
  option
– Remove a superfluous error message
2022-04-19 17:11:13 +02:00
Sébastien Villemot 7fff8b3406
Fix detection of nonlinearity of blocks of type “Solve backward/forward simple”
They were always marked as linear.
2022-03-15 16:47:03 +01:00
Sébastien Villemot f17c40f272
Cosmetics 2022-01-21 11:31:35 +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 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 a73b0d911a
Fix logic of include_eqs in the presence of [static]/[dynamic] equations
In a model with [static]/[dynamic] equations, if the user was using include_eqs
with a list of equations that does *not* contain equations marked
[static]/[dynamic], then the call to ModelTree::includeExcludeEquations(…,
static_equations=true) would have an empty list of equation tags (as stored
in tag_eqns).

The right behaviour in this case is to exclude all static equations. However,
the code would exclude none, and this would disrupt the equilibrium between
[static] and [dynamic] equations (since all [dynamic] equations were excluded
by the other call to the same method).

The fix consists in removing the shortcut that returns from the method if
tag_eqns is empty.
2021-12-10 12:50:10 +01:00
Sébastien Villemot 5fe94ed606
Simplify constant equations also in equations marked [static]
The simplifyEquations() methods had to be moved to DynamicModel, in order to
access the static_only_equations member.
2021-12-06 17:17:37 +01:00
Sébastien Villemot 8bb8e59410
Improve message for GCC installation under macOS 2021-10-08 12:59:17 +02:00
Sébastien Villemot 3d215020ae
Fix use_dll on macOS + Octave
Enforce GCC with mkoctfile. Otherwise Clang will be used, and it does not
accept our custom optimization flags.

Ref. dynare#1797
2021-09-13 16:50:13 +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 e6e25a5c87
macOS: fix detection of GCC installed by Dynare package
Since the preprocessor has moved, the relative path of the local Homebrew needs
to be adjusted.
2021-06-24 15:16:55 +02:00
Sébastien Villemot 1c3e6f89af
macOS: bump to GCC 11 (for compilation and for use_dll) 2021-06-24 12:34:29 +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 c5f9ae89e7
Implement new “occbin” option to “model” block
For the time being, the preprocessor will refuse that this option be used with
any command other than estimation.

By the way, remove occbin_likelihood and occbin_smoother options to estimation.

Ref. dynare#569
2021-05-31 10:00:59 +02:00
Sébastien Villemot 97e9609c28
Streamline use_dll compilation under MATLAB
— drop Windows 32-bit support
— drop -fno-omit-frame-pointer compilation flag under GNU/Linux
— drop -static-libstdc++ flag under Windows
— no longer link to -lstdc++ under GNU/Linux and macOS
— gracefully fail when 'mexext' value is unknown
2021-05-24 18:21:23 +02:00
Sébastien Villemot 825b9ee8ef
Fix bugs introduced in d3e115194b
Ref. #65
2021-02-19 20:29:18 +01:00
Sébastien Villemot 89e2daf7c7
C++17 modernization: convert the remaining enums to enum classes 2021-02-01 12:05:06 +01:00
Sébastien Villemot 7468b4d8d7
Remove more stuff related to unfinished decomposition in linear and nonlinear blocks
Ref. #39, dynare!1626
2021-01-25 18:13:35 +01:00
Sébastien Villemot af9bd8f109
Remove the unfinished decomposition in linear and nonlinear blocks
Also remove the det_cond_forecast interface, that was related to it.

Ref. dynare!1626
Closes: #39
2021-01-25 18:03:37 +01:00
Sébastien Villemot ab656f2d84
macOS/use_dll: upgrade to gcc-10 compiler 2021-01-13 15:42:09 +01:00
Sébastien Villemot a0d12310cb
macOS/use_dll: drop -mmacosx-version-min=10.9 flag
The MEX files are not intended for distribution to other systems.
2021-01-13 15:42:09 +01:00
Sébastien Villemot c91178e3e3
macOS/use_dll: no longer pass -arch x86_64, in preparation for ARM support 2021-01-13 15:42:09 +01:00
Sébastien Villemot 98d01cbbb6
Provide a meaningful error message when 'use_dll' option is used without 'matlabroot' 2020-09-18 15:00:47 +02:00
Sébastien Villemot 7bca47385d
Fixes to include_eqs/exclude_eqs
— fix segfault due to bad handling of iterators while erasing elements of a set
— fix logic for excluding endogenous variable when it is present on the LHS
2020-07-23 11:06:57 +02:00
Sébastien Villemot db8c5439f7
use_dll: higher order derivatives are now returned as sparse matrices by static/dynamic files
Previously they were returned as 3-column matrices. But this was inconsistent
with the M-file mode.
2020-06-23 17:50:50 +02:00
Sébastien Villemot ad5e196d30
Block decomposition now compatible with 'use_dll' option 2020-06-23 15:13:04 +02:00
Sébastien Villemot dc28aaa5e9
Block decomposition: fix bug in reduction of block decomposition
Some evaluated blocks could be incorrectly merged, leading to wrong
results (e.g. blocks incorrectly marked as evaluable forward).

Bug introduced in 39407083be
2020-06-17 19:42:13 +02:00
Sébastien Villemot 79763911b2
Block decomposition: in the dynamic file, y and T are now vectors as in non-block mode 2020-06-17 16:49:12 +02:00
Sébastien Villemot d530ccd012
Misc cosmetic improvements 2020-06-05 17:12:15 +02:00
Sébastien Villemot b402e35683
In the driver file, provide mapping between model local variables and indices in the temporary terms vector
The structures are M_.model_local_variables_{dynamic,static}_tt_idxs.

Ref. dynare#1722
2020-06-05 17:12:15 +02:00
Sébastien Villemot 90b9b6a1e4
JSON output: write model local variables in parsed model (modfile.json)
Ref. dynare#1723
2020-06-05 16:10:38 +02:00
Sébastien Villemot f9ab44da56
JSON output: do not append two underscores after model local variable names in their definition
This is inconsistent with the way they are printed in equations (without
underscores).

The practice of appending underscores only makes sense in a MATLAB workspace context.
2020-06-05 16:10:37 +02:00
Sébastien Villemot 931935a942
Bug fix: allow external functions in model local variables 2020-06-05 14:50:06 +02:00
Sébastien Villemot 7b11898689
use_dll: merge the two generated C source files into a single one
Also, do various other cosmetic/simplification changes.
2020-05-29 16:12:01 +02:00
Sébastien Villemot faa6666abe
Block decomposition: no longer use global variables for temporary terms in the dynamic M-file
Rather use a single vector as in non-block mode.

By the way, change the order of output arguments in static functions, to be
closer to the dynamic ones.
2020-05-26 16:21:11 +02:00
Sébastien Villemot a6d9ba6e55
Rename EquationType::evaluate_s to evaluateRenormalized, for clarity 2020-05-20 11:49:32 +02:00
Sébastien Villemot 2944484442
Bytecode: rename output methods for better consistency 2020-05-19 17:45:33 +02:00