Commit Graph

3350 Commits (42ea2aac34aea56e71a5ded99dd458d8eb34de1f)

Author SHA1 Message Date
Sébastien Villemot 42ea2aac34
Fix typo 2023-03-24 19:02:33 +01:00
Sébastien Villemot 89a1a4d27f
Remove unused function 2023-03-24 19:02:33 +01:00
Sébastien Villemot 5ff503a964
Use map::try_emplace() instead of map::emplace() to simplify some calls
By the way, remove a redundant Cluster{} constructor call.
2023-03-23 16:10:42 +01:00
Sébastien Villemot 7c6402cc34
DataTree: optimize the filling of node maps
Use map::{try,}emplace() instead of operator[], which should in theory be
slightly faster.
2023-03-23 16:10:40 +01:00
Sébastien Villemot 69a394a115
ExprNode: factorization of code that recurisively applies a transformation on a node 2023-03-23 12:39:35 +01:00
Sébastien Villemot 661f116af1
Rename the argument to ExprNode::clone() for clarity
The argument had the same name as the data member “datatree”, so this could
lead to confusion (though there was no bug, since the argument was masking
the data member).
2023-03-23 12:39:35 +01:00
Sébastien Villemot 2f111f5055
ExprNode: simplification of external function nodes clone() and toStatic() methods 2023-03-23 12:39:11 +01:00
Sébastien Villemot bff80c0eaf
use_dll: under Windows, append MinGW location to the PATH variable only once
Previously, the MinGW location was appended multiple times to the PATH
variable, which in some cases would make the variable too long and thus
dysfunctional.

The variable is now initialized once when the worker threads are created.

By the way, move the macOS+Octave environment variable initializations to the
same place, for consistency.
2023-03-20 18:27:33 +01:00
Sébastien Villemot a219c68543
Macroprocessor: drop useless Expression::clone() method 2023-03-16 11:36:41 +01:00
Sébastien Villemot 96e7a764b2
Macroprocessor: make method Expression::eval() const 2023-03-16 11:32:50 +01:00
Sébastien Villemot df7144525d
CI: remove useless quotes 2023-03-13 17:36:20 +01:00
Sébastien Villemot ba78d0c813
CI: adapt for new macOS runner
- enforce x86-64 architecture
- use “sysctl -n hw.ncpu” instead of “nproc” (which has not been installed in
  the new runner)
2023-03-13 17:33:05 +01:00
Sébastien Villemot 715ec9e4bc
Fix bytecode for block+mfs>0 in static model
Variable indices would be incorrect in the evaluated Jacobian if recursive
variables were present. This would lead to incorrect results and/or crashes in
bytecode MEX. This bug has been exposed by commit
f45a99fc68, which actually enabled mfs>0 for
static models.
2023-03-03 17:45:08 +01:00
Sébastien Villemot 7acf278370
Performance improvement of chain rule derivation
Commit 23b0c12d8e introduced caching in chain
rule derivation (used by block decomposition), which increased speed for mfs >
0, but actually decreased it for mfs=0.

This patch introduces the pre-computation of derivatives which are known to be
zero using symbolic a priori (similarly to what is done in the non-chain rule
context). The algorithms are now identical between the two contexts (both
symbolic a priori + caching), the difference being that in the chain rule
context, the symbolic a priori and the cache are not stored within the ExprNode
class, since they depend on the list of recursive variables.

This patch brings a significant performant improvement for all values of the
“mfs” option (the improvement is greater for small values of “mfs”).
2023-03-02 17:52:36 +01:00
Sébastien Villemot f8edce01ec
Minor simplification 2023-03-02 17:28:03 +01:00
Sébastien Villemot bf8ca27a47
Make ExprNode::prepareForDerivation() a protected member (was public) 2023-03-02 16:08:55 +01:00
Sébastien Villemot fe83933b1d
Bugfix: undefined behaviour in AbstractExternalFunctionNode::prepareForDerivation()
Input and output ranges should not overlap when calling std::set_union(),
otherwise the behaviour is undefined.

It seems that in this precise case the computation would still be
correct (though inefficient), because of the properties of std::set or because
of the specific implementation in libstdc++. But it’s better to be on the safe
side.
2023-03-02 15:55:51 +01:00
Sébastien Villemot 41052ccb74
Optimization for derivation of STEADY_STATE(…) operator in a dynamic context
In a dynamic context, the only potentially non-null derivatives of
STEADY_STATE(…) are the parameters. We know that the derivatives w.r.t. other
variables are zero, so store that information in non_null_derivatives.
2023-03-02 15:11:49 +01:00
Sébastien Villemot d64317a64f
Minor simplification 2023-03-02 15:11:47 +01:00
Sébastien Villemot 13e51fba6b
CI: various cleanups
- drop the Julia stuff, since it is no longer used
  In particular, no longer use static linking, since builds are now only
  for testing purposes and are not shipped
- drop the Windows i686 build, since we no longer support that configuration
- bump Boost version used for Windows x86-64 build
- rename build_linux_aarch64 into build_linux_arm64 for clarity
2023-03-01 13:04:02 +01:00
Sébastien Villemot ae83974e0e
Minor simplification using if with initialization 2023-02-28 16:27:31 +01:00
Sébastien Villemot 62c455ff56
Misc simplifications using STL algorithms 2023-02-28 16:27:29 +01:00
Sébastien Villemot 008a80910e
Bytecode: move CodeLoad class out of the preprocessor 2023-02-21 16:01:27 -05:00
Sébastien Villemot a88b921991
Bytecode: improve deserialization routines for FCALL and FBEGINBLOCK 2023-02-17 16:20:40 -05:00
Sébastien Villemot cf3ab36ac8
Bytecode: simplify specialized serialization methods 2023-02-17 15:31:22 -05:00
Sébastien Villemot 114d8eadfb
New “homotopy_alt_starting_point” option to “perfect_foresight_solver” command 2023-02-07 14:44:59 -05:00
Sébastien Villemot 389a2647d3
Block decomposition: make mfs=1 the default
NB: mfs=3 is nevertheless used when “block” option has not been used, and the
model is purely backward/forward or static, for solve_algo={12,14}.
2023-01-25 18:38:58 +01:00
Sébastien Villemot dc966014a3
Remove some incorrect normalization rules for the case mfs=3
More precisely, incorrect equation normalization could occur in the presence of
cos, sin, tan, cosh and x^n (where n is an even integer).

Also add some comments explaining why some other rules are (hopefully) correct.
2023-01-25 17:14:01 +01:00
Sébastien Villemot 0ddcf81ac0
Fix typo 2023-01-25 16:50:56 +01:00
Sébastien Villemot 1c813a1cf9
Run detrending engine if trend variables are present, even if unused in a var(deflator=…) statement
Closes: #113
2023-01-24 14:14:40 +01:00
Sébastien Villemot 74e5bbf537
Drop dynamic_g1_nz.m generated file
No longer needed since perfect_foresight_problem MEX has moved to the sparse
representation.
2023-01-23 16:20:12 +01:00
Sébastien Villemot 4f9241442c
Fix size of dynamic derivatives (legacy representation) when there are unused exogenous and “nostrict” option is given 2023-01-19 11:00:32 +01:00
Sébastien Villemot c47d91c20b
Block decomposition: another fix for sparse indices of static Jacobian when mfs > 0 2023-01-19 10:03:37 +01:00
Sébastien Villemot 7db02b23e9
Block decomposition: fix sparse indices of static Jacobian when mfs > 0 2023-01-17 19:04:21 +01:00
Sébastien Villemot 9013a5cb1b
No longer create +<basename>/+block/ folder (now empty) 2023-01-17 18:42:40 +01:00
Sébastien Villemot f45a99fc68
Correctly propagate “mfs” and “cutoff” to the static model
Those two settings were previously always at their default value for the static
model, independently of what the user would set in the .mod file.
2023-01-17 16:38:03 +01:00
Sébastien Villemot fe503d3eab
Remove confusing comment 2023-01-17 16:37:24 +01:00
Sébastien Villemot 4bba274f39
Block decomposition: drop unused max lead/lag fields
Note that DynamicModel::determineBlockDerivativesType(), it’s legitimate to
replace max_{lead,lag} by max_endo_{lead,lag}, because for exogenous
lag=lead=0, and we no longer compute derivatives w.r.t. to endogenous that do
not belong to the block (so-called “other” endogenous).
2023-01-17 14:42:29 +01:00
Sébastien Villemot 2e09df90e7
Bytecode w/ block decomposition: no longer output derivatives w.r.t. exogenous and endogenous outside the block 2023-01-17 14:23:40 +01:00
Sébastien Villemot 1e377f061a
Block decomposition: drop unused structure fields 2023-01-17 14:18:41 +01:00
Sébastien Villemot bbdbd0807b
Sparse representation: Octave compatibility fix
Octave does not support “private” subdir inside plus folders (“+namespace”).

See https://savannah.gnu.org/bugs/?45444
2023-01-16 17:12:10 +01:00
Sébastien Villemot 8ebd9a9496
Drop the “Sigma_e” statement 2023-01-16 15:08:23 +01:00
Sébastien Villemot a7b0a324c9
Drop the “periods” statement 2023-01-16 15:02:50 +01:00
Sébastien Villemot 93b9ed6957
Drop the legacy representation of the block-decomposed model
As a consequence, and as a temporary measure, always output the
non-block-decomposed legacy representation.

Also drop the block kalman filter output, and drop now useless variables in
M_.block_structure.
2023-01-13 16:57:06 +01:00
Sébastien Villemot 35ac73fad8
Sparse representation: fix various bugs in the non-block MATLAB/Octave output 2023-01-10 15:58:45 +01:00
Sébastien Villemot e18ecc3fa5
ModFile::remove_directory_with_matlab_lock(): minor performance improvement
Use std::filesystem::file_status and cached directory entries information to
avoid extra filesystem operations.
2023-01-10 11:49:39 +01:00
Sébastien Villemot bae04fa899
ModelTree::findGccOnMacOS() now returns a std::filesystem::path 2023-01-10 11:48:33 +01:00
Sébastien Villemot a4f299c0b7
Bytecode: change interface of function called from bytecode MEX 2023-01-09 14:09:09 +01:00
Sébastien Villemot ec3ce156b4
Bytecode: always produce block and non-block versions
The block decomposed version is now under <BASENAME>/bytecode/block/.
2023-01-09 13:35:49 +01:00
Stéphane Adjemian (Guts) 4348f4d57f
Provisions for conditional likelihhod estimation. 2023-01-06 12:17:02 +01:00