Commit Graph

191 Commits (482ec5fb67782d80083c208d75c18f3a5a2f78d2)

Author SHA1 Message Date
Sébastien Villemot 482ec5fb67
macOS: bump to GCC 12 (for compilation and for use_dll) 2022-09-06 11:53:40 +02:00
Sébastien Villemot a58109d094
Bytecode: refactor methods for writing .cod and .bin files in the block decomposition case 2022-07-20 16:02:24 +02:00
Sébastien Villemot d598810329
Bytecode: minor simplification using syntax of sizeof operator without parentheses 2022-07-20 14:48:30 +02:00
Sébastien Villemot ae150d2b1f
Bytecode: refactor routines for creating .cod file in non-block mode 2022-07-13 18:51:01 +02:00
Sébastien Villemot 157c67e04b
New helpers to simplify common operations with derivation IDs 2022-07-12 16:30:45 +02:00
Sébastien Villemot 1d71386f01
Further templating of helpers for writing output files
So that more stuff is computed at compile-time (using constexpr features).
2022-07-12 16:23:28 +02:00
Sébastien Villemot 4370b76ce4
Remove unused function 2022-07-12 16:18:19 +02:00
MichelJuillard 3e1f9dbb82 use @inbounds blocks instead of @inbounds for each line 2022-07-12 13:07:33 +02:00
Sébastien Villemot f38c8278ae
Refactor methods for writing static and dynamic files
– factorize common code between the static and the dynamic version
– reorganise language-specific code into dedicated functions
– use a function template in the main helper to do some computations
  at compile-time (using constexpr features)
2022-07-11 22:29:28 +02:00
Sébastien Villemot c8b046ec86
Simplification using non-default std::ofstream constructor 2022-07-11 22:17:36 +02:00
Sébastien Villemot 6d2d73a5d7
Bytecode: refactor output methods around an enum class similar to ExprNodeOutputType
By the way, add assertions to ensure that assignment LHS output type is only
used on VariableNode(s) and AbstractExternalFunctionNode(s).
2022-07-06 16:46:40 +02:00
Sébastien Villemot 93ef4c6feb
Small simplification 2022-07-05 17:08:29 +02:00
Sébastien Villemot 3d21821d0c
JSON output: remove duplicate “rhs” field when RHS of equation is non-zero constant 2022-07-05 17:08:29 +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 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