Commit Graph

3301 Commits (4348f4d57f83aa8f96c3ec23899c33971e847428)

Author SHA1 Message Date
Sébastien Villemot 2fdc8b682e Merge branch 'BGP_space' into 'master'
Add missing whitespace in output of BGP warning

See merge request Dynare/preprocessor!65
2022-09-06 10:11:51 +00:00
Sébastien Villemot 482ec5fb67
macOS: bump to GCC 12 (for compilation and for use_dll) 2022-09-06 11:53:40 +02:00
Johannes Pfeifer da5b36704d Add missing whitespace in output of BGP warning 2022-08-03 10:52:08 +02:00
Sébastien Villemot fc4c9a73c9
Fix comment
[skip ci]
2022-07-27 16:50:08 +02:00
Sébastien Villemot c3cb7ca534
Bytecode: simplify type for storing list of instructions
Incidentally, make BytecodeInstruction an immutable struct, to facilitate
access to opcode in such a list.
2022-07-26 18:26:37 +02:00
Sébastien Villemot 613e0da782
Bytecode: add some comments to FNUMEXPR_
[skip ci]
2022-07-26 14:52:10 +02:00
Sébastien Villemot 21cecee599
Add “fsolve_options” option to “steady” command
Ref. dynare#1856
2022-07-22 13:43:41 +02:00
Sébastien Villemot ad40f1365c
Block decomposition: code factorization 2022-07-21 18:20:35 +02:00
Sébastien Villemot d4c453c422
Block decomposition: (likely) performance improvement in static file in relation to temp terms
Compute temporary terms for derivatives of “evaluate” mode, even though those
derivatives are not computed. This is because the temporary terms may be useful
for subsequent blocks.

By the way, add an explanatory comment for the equivalent code in dynamic file.
2022-07-21 17:31:48 +02:00
Sébastien Villemot a97a41f6c0
Bugfix with temporary terms in block+bytecode
There were actually two distinct bugs, leading to incorrect results in some
corner cases:

– in the “evaluate” mode of the bytecode MEX, the temporary terms of the
  derivatives “evaluate” blocks were not evaluated at runtime; but these
  temporary terms may be needed for residuals of subsequent blocks;

– when the bytecode MEX was only computing residuals of the model (and not 1st
  order derivatives), the temporary terms of the derivatives were not evaluated
  at runtime; but these temporary terms may be needed for residuals of subsequent
  blocks.
2022-07-21 17:22:08 +02:00
Sébastien Villemot 1401c85d6a
Bytecode: drop FCUML instruction
It’s redundant with FBINARY{BinaryOpcode::plus}.
2022-07-20 16:02:24 +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 50d5b916e2
Remove constructor and accessors for AuxVarInfo
Rather make all data members public and const, and use aggregate-initialization.
2022-07-20 14:48:30 +02:00
Sébastien Villemot f0629555a5
Remove useless constructors (aggregate initialization is enough for those)
By the way, turn those classes into structs since all their members are public.
2022-07-20 14:48:28 +02:00
Sébastien Villemot 83a94aca57
Replace most uses of std::string::compare() by operator==(), for clarity 2022-07-20 11:18:20 +02:00
Sébastien Villemot c0bfc99946
Minor simplification using std::vector::emplace_back() 2022-07-20 11:18:07 +02:00
Sébastien Villemot 435e56369c
Compatibility fixes with GCC 12 2022-07-16 12:46:16 +02:00
Sébastien Villemot 35dc7fcd81
Bytecode: fix treatment of temporary terms (in non-block mode)
The “temporary_terms_union.insert(it)” statement introduced in the previous
commit was in the wrong block.

By the way, replace the “switch” by an “if constexpr”.
2022-07-14 09:17:11 +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 89debf429a
Factorize code for writing JSON output 2022-07-12 18:04:05 +02:00
Sébastien Villemot 6da24fc763
Fix bug in JSON output for dynamic derivatives w.r.t. parameters
Variable and parameter indices were wrong (offset by 1).
2022-07-12 17:45:00 +02:00
Sébastien Villemot 9e6c01f132
Streamline some function names 2022-07-12 17:04:41 +02:00
Sébastien Villemot a541d23055
Minor simplification 2022-07-12 16:39:17 +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 2013056a2c
Fix bug in JSON output for derivatives w.r.t. parameters
Confusion between a symbol ID and a derivation ID, which could lead to invalid
output or crash.
2022-07-12 16:23:44 +02:00
Sébastien Villemot 440173f2bc
Further simplification made possible by 75e453c5fe53ce9ce82e564577db073b41a0459a 2022-07-12 16:23:40 +02:00
Sébastien Villemot 7fd78606ae
Fix bug in MATLAB/Octave output introduced in 3e1f9dbb82 2022-07-12 16:23:32 +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
Sébastien Villemot 9c3eeb7c8d
Refactor code for writing derivatives w.r.t. parameters 2022-07-12 16:18:16 +02:00
Sébastien Villemot 8da663a110
Further factorization in methods for writing static and dynamic files 2022-07-12 16:05:15 +02:00
Sébastien Villemot 3eb7063838 Merge branch 'julia-2' into 'master'
Julia 2

See merge request Dynare/preprocessor!64
2022-07-12 11:29:23 +00:00
MichelJuillard 3e1f9dbb82 use @inbounds blocks instead of @inbounds for each line 2022-07-12 13:07:33 +02:00
MichelJuillard a4556896db Julia functions Float64 -> <: Real 2022-07-12 11:15:51 +02:00
Sébastien Villemot 5174c3b52c
Minor simplification 2022-07-11 22:30:50 +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 92047f547e
Minor simplification 2022-07-11 14:05:29 +02:00
Sébastien Villemot 9b34fe856f
Add missing “break” for consistency 2022-07-08 16:10:23 +02:00
Sébastien Villemot 4b30342dc2
Bytecode: various simplifications
Also improve the naming of the enum class used for identifying the type of
external function call.
2022-07-08 16:02:49 +02:00
Sébastien Villemot a7dc96516b
Minor cleanup 2022-07-08 15:13:21 +02:00
Sébastien Villemot 69354e0aec
More C++20 modernization 2022-07-08 14:52:21 +02:00
Sébastien Villemot 4867120757
Remove unused function 2022-07-08 14:44:01 +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 c27342cfeb
Fix interaction of temporary terms with steady_state operator
When the same complex expression appears outside and inside a steady_state()
operator, the same temporary term would be used for both cases, which was
obviously wrong.

The fix consists in never substituting temporary terms for expressions inside
the steady_state operator().

Incidentally, this implies that external functions can no longer be used inside
steady_state operators (since their computed values are stored inside temporary
terms).
2022-07-05 17:08:27 +02:00
Sébastien Villemot db0d9290b5
Bytecode: remove hack for exogenous deterministic index
The support in the bytecode MEX was broken anyways.
2022-07-05 14:10:34 +02:00
Sébastien Villemot c27354ace0
Bytecode: change name of 2nd argument of ExprNode::writeBytecodeOutput(), for clarity 2022-07-04 17:10:44 +02:00