Sébastien Villemot
4313640f80
Bytecode: allow better compiler optimization of the main evaluation function
...
Use the __restrict__ GCC extension on double* pointers, to avoid aliasing.
NB: the C “restrict” keyword does not exist in C++.
2023-04-18 17:45:15 +02:00
Sébastien Villemot
d71db85c71
Bytecode: move more cached information about current block out of the Evaluate class
2023-04-18 17:44:55 +02:00
Sébastien Villemot
36e8062e25
Bytecode: remove Evaluate::{EQN_block,EQN_block_number}
2023-04-18 17:37:35 +02:00
Sébastien Villemot
d789e6a4c5
Bytecode: move storage for variable and parameter values out of the Evaluate class
2023-04-18 17:37:33 +02:00
Sébastien Villemot
d0864689d2
Bytecode: minor simplification related to Evaluate::steady_state
2023-04-18 14:23:26 +02:00
Sébastien Villemot
73e4ced39a
Remove more unused Dynare++ code
...
In particular, the libkorder library no longer depends on MatIO.
2023-04-17 18:10:36 +02:00
Sébastien Villemot
99cd06c9fd
Move relevant Dynare++ files to mex/sources/libkorder/. Delete the others.
...
Also move some useful documentation to doc/.
2023-04-17 18:10:35 +02:00
Sébastien Villemot
36db88c56c
qmc_sequence MEX: use the Fortran version of John Burkardt’s code (instead of C++)
...
Incidentally, this greatly diminishes the compilation time of the MEX.
2023-04-15 16:19:35 +02:00
Sébastien Villemot
85351d751c
🐛 qmc_sequence MEX: large input seeds would be truncated
...
The int64 input seed was converted to a double before being converted back to
an int64. But large integers cannot be represented exactly in a double.
2023-04-15 15:48:55 +02:00
Sébastien Villemot
9dff1ff28e
🐛 Workaround for buggy int64_T and uint64_T types under Windows with MATLAB < R2015b
...
This bug would impact the qmc_sequence MEX, which manipulates an int64
input/output argument (the seed). Thanks to little-endianness, the bug would
however only manifest for seeds > 2³¹.
2023-04-15 15:48:54 +02:00
Sébastien Villemot
e9ecce8293
ricatti_update MEX: remove unused variable
2023-04-15 13:03:43 +02:00
Sébastien Villemot
3bf40d92f8
blas_lapack.F08: minor simplification
2023-04-15 12:50:44 +02:00
Sébastien Villemot
640be269af
Add “implicit none” statements in BLAS/LAPACK interfaces for safety
2023-04-14 15:08:53 +02:00
Sébastien Villemot
62c2881bc2
Fortran 2018 modernization: use the extended “implicit none” syntax
...
The statement “implicit none” forbids implicit typing of variables, but not
implicit procedure declaration. The new “implicit none (type, external)” syntax
forbids both, and is thus safer.
2023-04-14 15:06:37 +02:00
Sébastien Villemot
9f29e2f292
Bytecode: add missing floating point exception handling for sqrt and several trigonometric functions
2023-04-07 17:32:36 +02:00
Sébastien Villemot
2740bdee58
Bytecode: remove default clause in switch/case clauses for opcodes
...
This ensures that we will get a compiler warning reminding us to support
opcodes that may be added in the future.
2023-04-07 16:46:35 +02:00
Sébastien Villemot
1622c74a53
Bytecode: add missing support for cbrt(), abs() and sign() operators
2023-04-07 16:46:35 +02:00
Sébastien Villemot
f27c3abd2f
Bytecode: refactor floating point exception handling
2023-04-07 16:46:32 +02:00
Sébastien Villemot
fbaa051489
Bytecode: minor simplification
2023-04-07 10:26:57 +02:00
Sébastien Villemot
8128fd4cc3
Bytecode: minor improvements of interfacing with UMFPACK
2023-04-03 18:34:55 +02:00
Sébastien Villemot
c4ad1d58e8
Bytecode: minor simplification to debug mode
2023-04-03 18:34:45 +02:00
Sébastien Villemot
d3afa980aa
MEX: better type definition for long SuiteSparse integers under Windows
2023-04-03 18:31:04 +02:00
Sébastien Villemot
d078810625
MEX: remove obsolete MSVC check
2023-04-03 14:59:36 +02:00
Sébastien Villemot
a45b00fa69
MEX: better type definition for BLAS/LAPACK integers in C and C++
...
int64_t on 64-bit machines better expresses the intent than ptrdiff_t. This is
also more consistent with what is done in Fortran.
2023-04-03 14:58:07 +02:00
Sébastien Villemot
f0888468e6
Bytecode: optimize memory consumption during iterations
...
mxArray objects were not properly destroyed within the iteration loop, leading
to higher memory usage. Note that there was no memory leak, because these
objects would be destroyed later by MATLAB when exiting the MEX.
2023-04-03 14:14:33 +02:00
Sébastien Villemot
5a1abb1b87
Bytecode: cleanup memory management for UMPACK memory buffers
...
There was probably no bug but it is safer this way.
2023-03-31 18:43:16 +02:00
Sébastien Villemot
8dae5393f5
Bytecode: remove unused function
2023-03-31 17:37:31 +02:00
Sébastien Villemot
403db2cc64
Bytecode MEX: under Octave, use system-wide umfpack.h instead of our own version
2023-03-31 16:18:27 +02:00
Sébastien Villemot
c7d2ea0a62
Bytecode: remove meaningless initializations
2023-02-24 15:29:52 -05:00
Sébastien Villemot
325e6487d4
Bytecode: move computation routines out of the Evaluate class
2023-02-24 15:18:43 -05:00
Sébastien Villemot
17df930eb9
Bytecode: remove unused function
2023-02-24 15:01:35 -05:00
Sébastien Villemot
0e1678c13a
Bytecode: no longer have instruction pointer as a member variable of Evaluate class
2023-02-24 14:30:15 -05:00
Sébastien Villemot
13b3208cdb
Bytecode: move all logic for navigating through the .cod file into the Evaluate class
2023-02-23 17:37:08 -05:00
Sébastien Villemot
aaab993ccf
Bytecode: merge CodeLoad class into Evaluate
2023-02-23 11:21:22 -05:00
Sébastien Villemot
895ce96c61
Bytecode: fix memory management for FBEGINBLOCK and FCALL tags
...
FCALL was not properly deallocated, hence leading to a memory leak.
Also simplify the handling of FBEGINBLOCK through a std::unique_ptr.
2023-02-21 16:58:45 -05:00
Sébastien Villemot
1ad6b29936
Bytecode: misc minor simplifications
2023-02-21 16:31:08 -05:00
Sébastien Villemot
24b2976ac2
Bytecode: move CodeLoad class out of the preprocessor
2023-02-21 16:02:21 -05:00
Sébastien Villemot
05ba2970be
Bytecode: diminish the number of data members in Evaluate class
2023-02-17 13:46:41 -05:00
Sébastien Villemot
c3e1480a52
C++17 modernization: use std::extent_v to get raw arrays size
...
This can prevent mistakes when the array is modified.
2023-01-24 13:43:02 +01:00
Sébastien Villemot
7922fc011e
perfect_foresight_problem MEX: move to the sparse representation
...
Ref. #1859
2023-01-24 13:43:00 +01:00
Sébastien Villemot
4ecc78a931
Preprocessor: drop unused per-block max lead/lag fields
2023-01-17 14:43:56 +01:00
Sébastien Villemot
0c5c96e724
Bytecode w/ block decomposition: no longer output derivatives w.r.t. exogenous and endogenous outside the block
2023-01-17 14:24:02 +01:00
Sébastien Villemot
8f1a4cb363
Drop block-decomposed first-order perturbation solution and kalman filter
2023-01-13 16:57:49 +01:00
Sébastien Villemot
f84753025d
Bytecode: the block and non-block versions now coexist in parallel
...
As a consequence, a new “block_decomposed” option of the bytecode MEX has been
introduced to explicitly select the block-decomposed version.
Note that we do not always use the “block_decomposed” option even when the
“block” option has been passed to the user, in situations where the block
decomposition brings nothing (e.g. when evaluating the residuals of the whole
model).
2023-01-09 15:20:46 +01:00
Sébastien Villemot
9c4dd1b1d0
Remove irrelevant comment
...
[skip ci]
2023-01-04 15:00:27 +01:00
Sébastien Villemot
d574705b4a
Design and performance improvement to solve_algo={12,14}
...
Use the new time-recursive block decomposition computed by the preprocessor
for:
- the simulation of backward models with “simul_backward”
- the perfect foresight simulation of purely backward/forward/static models
Also note that in this case, the preprocessor now defaults to “mfs=3” (i.e. it
minimizes the set of feedback variables and tries to renormalize equations).
This replaces the previous algorithm based on Dulmage-Mendelsohn (dmperm), plus
an ad hoc identification of some equations that can be evaluated (those with a
LHS equal to a variable, the log of a variable, or the diff-log of a variable).
By the way, the block_trust_region MEX has been modified so that it accepts a
boolean argument to decide whether it performs a Dulmage-Mendelsohn
decomposition (if not, then it performs a simple trust region on the whole
nonlinear system).
This provides a significant performance improvement (of almost an order of
magnitude for solve_algo=14 on a 700 equations model).
2022-11-30 14:47:57 +01:00
Sébastien Villemot
10fdc42516
block_trust_region MEX: add support for sparse Jacobian
...
If the function to be solved returns a sparse Jacobian, simply convert it to a
dense representation.
2022-11-30 14:47:57 +01:00
NormannR
a245fbb390
Implements a Fortran update of the states variance-covariance matrix for the Kalman filter
2022-11-14 16:24:46 +00:00
Johannes Pfeifer
fe0606ae06
logarithmic_reduction.m: use positive penalty add-on
2022-10-11 16:13:03 +02:00
NormannR
afb044c23e
Fix cycle reduction:
...
(i) making the norms consistent between cycle_reduction and its test;
(ii) remove hard errors in cycle_reduction Fortran and Matlab routines
2022-10-11 12:11:30 +02:00