Commit Graph

1022 Commits (master)

Author SHA1 Message Date
Sébastien Villemot 6f2af6943f
k_order_welfare MEX: use the sparse representation of the static model 2024-02-09 10:24:02 +01:00
Sébastien Villemot 0d9857e737
k_order_welfare MEX: drop ObjectiveAC abstract class, it has a single subclass 2024-02-08 14:03:03 +01:00
Sébastien Villemot b956a2253e
C++20 modernization: use abbreviated function template syntax 2024-01-26 16:43:00 +01:00
Sébastien Villemot 8954a682c7
Bytecode: error out when using det_cond_forecast with perfect_foresight shocks
They’re not implemented in bytecode.

Closes: #1884
2024-01-25 12:22:48 +01:00
Sébastien Villemot aee581fd0b
libkorder: make symiterator::operator== const
This fixes an ambiguity due to C++20 rewriting rules.
2024-01-24 09:52:11 +01:00
Sébastien Villemot 4683b9aeb6
C++17 modernization: add [[nodiscard]] to operator==() 2024-01-09 13:08:17 +01:00
Sébastien Villemot cb7bd0778b
C++20 modernization: drop comparison operators made obsolete by rewriting rules
The implicit conversion from Vector to ConstVector, in addition to the
rewriting rules and ConstVector::operator<=>, ensure that those are no longer
needed.
2024-01-09 13:08:17 +01:00
Sébastien Villemot 2fd4a6fac4
C++20 modernization: use new spaceship operator to simplify comparisons 2024-01-09 13:08:15 +01:00
Sébastien Villemot 2bfa311636
C++20 modernization: remove trivial != operator definitions
Those are no longer needed thanks to expression rewriting.
2024-01-09 12:12:38 +01:00
Sébastien Villemot 3ab9be71c8
🐛 k-order MEX: equality operator on symiterator had wrong name 2024-01-09 12:12:25 +01:00
Sébastien Villemot ffb578276e
Improve naming and description of various stack_solve_algo values
Also minor improvements to solve_algo description.
2024-01-05 16:03:19 +01:00
Sébastien Villemot 668f6de5df
Bytecode MEX: adapt for refactorings in the preprocessor 2023-12-14 17:31:26 +01:00
Sébastien Villemot 594facdb03
MEX files: homogeneize include guards
Also ensure that guards are not reserved identifiers (i.e. starting with an
underscore).
2023-12-13 17:33:55 +01:00
Sébastien Villemot 63d5569cf4
libkorder MEX: remove useless parameter copies and std::move calls in constructors
Automatically detected by clang-tidy using performance-unnecessary-value-param
and performance-move-const-arg checks.
2023-12-13 17:33:55 +01:00
Sébastien Villemot 00434c595d
libkorder MEX: mark Vector move constructor as noexcept
Automatically detected by clang-tidy with performance-noexcept-move-constructor
check.
2023-12-13 17:33:55 +01:00
Sébastien Villemot 4ef9245a95
MEX files: remove calls to virtual method during construction
Such calls may bypass virtual dispatch.

Automatically detected by clang-tidy with
clang-analyzer-optin.cplusplus.VirtualCall check.
2023-12-07 18:34:38 +01:00
Sébastien Villemot 91c677ca7f
MEX files: drop C++ preprocessor directives now obsolete
Dynare++ is no longer distributed as a standalone binary.
2023-12-07 17:57:01 +01:00
Sébastien Villemot 6a58316a3e
MEX files: disable clang-tidy false positive for call to std::strcpy 2023-12-06 22:24:57 +01:00
Sébastien Villemot 91f2dcdfe1
MEX files: use “auto” when initializing with a template cast to avoid duplicating the type name
Automatically detected by clang-tidy with modernize-use-auto check.
2023-12-06 22:24:56 +01:00
Sébastien Villemot de476ad5ac
MEX files: use a braced initializer list instead of repeating the return type
Automatically detected by clang-tidy with modernize-return-braced-init-list
check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 123f909b67
MEX files: use pass-by-value + std::move when possible in constructors
Automatically detected by clang-tidy with modernize-pass-by-value check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot fd9a89ab38
MEX files: use default member initialization when possible
Automatically detected by clang-tidy with modernize-use-default-member-init
check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 15b6e6e6b3
MEX files: no longer use “virtual” keyword when overriding a method
Automatically detected by clang-tidy with modernize-use-override check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 9d98811cfc
MEX files: use transparent functor for std::multiplies
Automatically detected by clang-tidy using modernize-use-transparent-functors
check.
2023-12-06 22:24:55 +01:00
Sébastien Villemot 8953007440
MEX files: remove unused variables or values
Automatically detected by clang-tidy using
clang-diagnostic-unused-but-set-variable, clang-analyzer-deadcode.DeadStores
and clang-diagnostic-unused-const-variable checks.
2023-12-06 22:24:55 +01:00
Sébastien Villemot d82eecfd39
C++11 modernization: use std::array and std::vector instead of C arrays
Automatically detected by clang-tidy using modernize-avoid-c-arrays check.
2023-12-06 22:24:52 +01:00
Sébastien Villemot 11c1f6175e
Add [[nodiscard]] attribute to various functions
Automatically detected using clang-tidy with modernize-use-nodiscard check.
2023-12-05 15:44:23 +01:00
Sébastien Villemot 7864370bfb
perfect_foresight_problem MEX: fix inclusion of dynmex.h
That header is needed from DynamicModelCaller.hh.

Issue detected by clang-tidy.
2023-12-04 18:21:18 +01:00
Sébastien Villemot 911437378c
Remove unused and unmaintained unit test for k-order 2023-12-04 18:21:18 +01:00
Sébastien Villemot 6f38dcd1d5
bytecode MEX: fix logical test
The test “solve_algo >= 6 || solve_algo <= 8” was always true.

Issue detected by clang-tidy using the
clang-diagnostic-tautological-overlap-compare check.
2023-12-04 18:21:13 +01:00
Sébastien Villemot bc6840ff6f
MEX libkorder: make destructor of SparseTensor class virtual
That class is a base class, so it must have a virtual destructor to avoid
memory leaks.

Issue detected by clang-tidy with
clang-diagnostic-delete-non-abstract-non-virtual-dtor check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot aeec4494b0
MEX libkorder: fix use of moved-from object
Detected by clang-tidy using clang-analyzer-cplusplus.Move check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot 857e5b00f5
C++ modernization: pass by value and use std::move when relevant
Automatically detected and fixed using clang-tidy with modernize-pass-by-value
check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot bd7703d160
C++ modernization: use a braced initializer list instead when relevant
Automatically detected and fixed using clang-tidy with
modernize-return-braced-init-list check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot a5445c52be
C++ modernization: more uses of auto keyword
Automatically detected and fixed using clang-tidy with modernize-use-auto
check.
2023-12-04 18:20:43 +01:00
Sébastien Villemot 403f20a7f3
C++ modernization: add [[nodiscard]] attribute to various functions
Automatically detected and fixed using clang-tidy with modernize-use-nodiscard
check.
2023-12-04 18:20:42 +01:00
Sébastien Villemot c6a7801ba8
clang-format configuration: set “PackConstructorInitializers: NextLine” 2023-11-30 14:37:05 +01:00
Sébastien Villemot ed332e3ba1
MEX files: reformat C++ source code using clang-format 15 2023-11-29 19:00:51 +01:00
Sébastien Villemot f21fda7dfa
Build system: enable the interleaved API in MEX files for Octave ⩾ 8.4.0
Unfortunately it is not possible to enable it for all supported Octave
versions (which would have allowed us to remove the old codepath), because of
this bug: https://savannah.gnu.org/bugs/?64687
2023-11-24 10:36:47 +01:00
Sébastien Villemot 7f58e819c6
Bump minimal required version of MATLAB to R2018b
Ref. #1907
2023-11-22 16:00:04 +01:00
Normann Rion a900f74cf3 Kalman filter mex: remove compilation warnings
Compilation wargnings were pointing at: (i) some supposedly uninitialized variables (-Wmaybe-uninitialized); (ii) a pointer assignment (=) to a non-pointer target (-Wsurprising).
2023-11-13 09:33:00 +00:00
Normann Rion 3a461c996c
Kalman filter mex: routine and tests 2023-11-09 19:00:37 +01:00
Sébastien Villemot 77a7d5c3de
For bytecode+block, use the LBJ implementation in .m
The latter is now much faster than the implementation in the bytecode
MEX (which this commit thus removes).
2023-11-08 17:21:44 +01:00
Sébastien Villemot 7dc90654ab
Bytecode: adapt for enum removal in preprocessor 2023-11-07 15:37:55 +01:00
Sébastien Villemot 93ab67acab
🐛 Bytecode MEX: fix bug with evaluation of recursive variables with block+mfs>0
In “evaluate” mode, with mfs>0, if the value of variable would depend on a
previously re-evaluated recursive variable, then the value used for that recursive
variable would be incorrect (it would be the value before re-evaluation of the
recursive variable, as passed by the caller).
2023-11-07 15:37:51 +01:00
Sébastien Villemot 7e512af074
Bytecode MEX: refactor handling of temporary terms
In particular:
– properly return temporary terms as output argument in evaluate+dynamic mode
  (with periods in rows and the temporary terms in column)
– drop the unused “global_temporary_terms” keyword input argument
2023-11-07 15:37:32 +01:00
Sébastien Villemot f6adb1d9ad
Bytecode: safer handling of block= option 2023-11-02 16:51:02 +01:00
Sébastien Villemot 6027d31da2
Bytecode: rename some methods in Interpreter for clarity 2023-10-20 14:31:46 -04:00
Sébastien Villemot b17ff164fc
Bytecode: rename argument in Interpreter::compute_block_time()
To avoid ambiguity with class member with same name.
2023-10-20 11:49:04 -04:00
Sébastien Villemot 753848ab4b
Bytecode: simplify Interpreter::Simple_Init() 2023-10-20 11:47:13 -04:00