Commit Graph

1068 Commits (rm-particles)

Author SHA1 Message Date
Normann Rion 23dbb2b4b9 Fixes local_state_space_iteration_3 and adds a test comparing the various pruning routines used in dynare up to order 3.
The considered pruning routines can be found in
   - `simult_.m`
   - `local_state_space_iteration_2` MEX
   - `local_state_space_iteration_3` MEX
   - `pruned_state_space_system.m`
2023-07-04 19:15:43 +02:00
Sébastien Villemot 8b945dfd64
libkorder: use infinity instead of large constant in minimization algorith
By the way, also use C++17 initialization within “if” statement.
2023-07-04 11:20:51 +02:00
Sébastien Villemot d6ea315a18
Bytecode: further improve some informative messages 2023-06-15 15:37:45 +02:00
Sébastien Villemot 192f136b96
Bytecode: improve some informative messages 2023-06-13 16:59:08 +02:00
Sébastien Villemot 277c5d4c4f
Bytecode: display real iteration time instead of CPU time 2023-06-13 16:59:08 +02:00
Sébastien Villemot 7c9e261355
Bytecode: fix treatment of maxit option
It would do one extra iteration.
2023-06-13 16:59:08 +02:00
Sébastien Villemot dcf56b89cd
Bytecode: rework message verbosity
Now uses options_.verbosity to decide what to print:
– if options_.verbosity == 0, prints nothing
– if options_.verbosity >= 1, prints iteration counter and duration, and fatal errors
– if options_.verbosity >= 2, additionally print floating point exceptions and
  details about algorithmic decisions
2023-06-13 16:59:07 +02:00
Sébastien Villemot 73b1850cb5
Bytecode: remove unused function 2023-06-13 16:58:06 +02:00
Sébastien Villemot 08d378c244
Bytecode: in evaluate+dynamic mode, return residuals with as many columns as periods
Previously it would also include initial and terminal conditions (i.e.
residuals would have periods+maximum_lag+maximum_lead columns). But we do not
care about residuals at the initial and terminal conditions.

This change is for consistency with the perfect_foresight_problem MEX.
2023-06-12 19:18:44 +02:00
Sébastien Villemot 90d790f1c3
Bytecode: fix error message 2023-06-12 19:18:44 +02:00
Sébastien Villemot d814a4090b
Bytecode: improve display of residuals error during iterations 2023-06-12 15:12:00 +02:00
Sébastien Villemot 4210618dba
🐛 perfect_foresight_problem MEX: check over size of M_.dynamic_g1_sparse_colptr size was incorrect 2023-06-06 16:57:48 +02:00
Sébastien Villemot e86aeaf787
C++20 modernization: use new standard mathematical constants 2023-05-25 19:07:23 +02:00
Sébastien Villemot 0f7ab97e69
🐛 local_state_space_iteration_3: real64 kind suffixes were missing for floating-point constants
Without the suffix, those constants were interpreted as
real32 (single-precision), hence leading to a loss of precision.
2023-05-24 21:18:23 +02:00
Sébastien Villemot 1b02026d1c
Fix GCC 13 warning about overloading that hides virtual methods of base class 2023-05-09 21:36:43 +02:00
Sébastien Villemot aeff2bf48d
Fix GCC 13 warning about ambiguity of operator==() in C++20
In C++20, a==b can also be implicitly rewritten as b==a, assuming
commutativity. But if the operator==(const &) is not declared as const, and is
thus asymmetric, this results in an ambiguity because neither of a==b or b==a
is a better match according to the overload resolution rules.
2023-05-09 21:36:41 +02:00
Sébastien Villemot 030316f2d8
Bytecode: misc simplifications 2023-04-18 22:25:58 +02:00
Sébastien Villemot afe147d88d
Bytecode: the class dynSparseMatrix is no longer derived from Evaluate 2023-04-18 18:10:45 +02:00
Sébastien Villemot e22972849b
Bytecode: make Evaluate::{symbol_table, steady_state} private and const 2023-04-18 17:46:48 +02:00
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 90a408e3c3
Build system: enable the dangling else warning (-Wdangling-else)
Adapt the code accordingly.
2023-04-11 17:31:18 +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 6dbc7c2a17
Windows package: improve hack for statically linking libgomp into MEX files
Link only the needed parts, instead of embedding the whole library.
2023-03-15 17:35:25 +01:00
Sébastien Villemot c7d2ea0a62
Bytecode: remove meaningless initializations 2023-02-24 15:29:52 -05:00