Sébastien Villemot
e22ca82ab6
Bytecode MEX: drop the ErrorMsg class and integrate most of its members inside the Evaluate class
2022-07-29 13:04:31 +02:00
Sébastien Villemot
034a981daa
Bytecode MEX: streamline error handling
2022-07-29 13:04:29 +02:00
Sébastien Villemot
4ec6c0dab4
Bytecode MEX: streamline preprocessor guards in includes
2022-07-29 12:40:33 +02:00
Sébastien Villemot
0076644bda
Bytecode MEX: fix bug with PowerDeriv printing introduced in ff85fc6489
2022-07-28 17:13:23 +02:00
Sébastien Villemot
7c4dc1abce
Bytecode MEX: in error messages, revert back to default floating point format
...
A move to fixed format was erroneously made in
4893f0e82c
and
ff85fc6489
, where stream formatting of floating
points has been replaced by the use of std::to_string().
2022-07-28 17:10:12 +02:00
Sébastien Villemot
6e1635658f
Bytecode MEX: split out code for dealing with variable names into a dedicated BasicSymbolTable class
2022-07-28 16:56:40 +02:00
Sébastien Villemot
5df3fde95e
Bytecode MEX: streamline function for adding tildes below FP error
2022-07-28 15:48:21 +02:00
Sébastien Villemot
ff85fc6489
Bytecode MEX: refactor the routines that display expressions in human-readable form
...
In particular, minimize the number of parentheses written, using the same
algorithm as in the preprocessor.
2022-07-27 18:06:08 +02:00
Sébastien Villemot
1b13bb2e6e
Bytecode MEX: simplify type for storing list of instructions
2022-07-26 18:27:23 +02:00
Sébastien Villemot
9d84048710
Bytecode MEX: fix bug introduced in 8c01912a50
...
Use an iterator wrapped inside std::optional instead of a possibly-singular
iterator, because the latter has undefined behaviour.
By the way, pass arguments by const reference.
2022-07-26 16:35:06 +02:00
Sébastien Villemot
dc224e71ed
Bytecode MEX: fix error messages for derivatives w.r.t. exogenous / exogenous deterministic
...
The wrong type was used for querying symbol names.
2022-07-26 16:35:06 +02:00
Sébastien Villemot
8c01912a50
Bytecode MEX: simplify printing of numerical errors in expression
...
In particular, no longer rely on a duplicate implementation of the evaluator to
locate where the NaN or Inf is produced. Rather directly pass the pointer to
the faulty operator.
2022-07-25 18:07:18 +02:00
Sébastien Villemot
a8351130f1
Bytecode MEX: bugfix in error message printing
...
Class Evaluate had data members with the same name as members of
ErrorMsg (which it derives from). In practice, this means that the data members
from ErrorMsg could be unitialized when displaying error messages.
2022-07-25 15:07:52 +02:00
Sébastien Villemot
feb10b75e6
Bytecode MEX: minor fix to debug mode
2022-07-20 16:19:49 +02:00
Sébastien Villemot
e87d643084
Preprocessor: various refactorings, mainly bytecode-related
2022-07-20 16:18:02 +02:00
Sébastien Villemot
b29dde227d
Preprocessor: various refactorings (mainly bytecode)
2022-07-08 16:05:33 +02:00
Sébastien Villemot
b3cff2d34d
Bytecode: remove incomplete/buggy support for exogenous deterministic
2022-07-05 13:02:17 +02:00
Sébastien Villemot
8be6f55bf6
Bytecode MEX: remove unused function parameters
2022-07-05 12:12:08 +02:00
Sébastien Villemot
b05ef5dd7f
Bytecode MEX: remove unused function
2022-07-05 12:11:32 +02:00
Sébastien Villemot
8dba4ec68c
Bytecode: minor fixes to debug mode
2022-06-24 12:53:19 +02:00
Sébastien Villemot
8a0eb76b1b
Use operator""s to replace some calls to std::string constructor
...
By the way, remove other unnecessary calls to that constructor.
2022-06-22 12:51:08 +02:00
Sébastien Villemot
0107365f6a
Bytecode: stop using unsigned integers where signed ones avoid unnecessary casts
2022-06-20 17:52:01 +02:00
Sébastien Villemot
8bee62fa5e
Bytecode: directly use several enums inside instruction classes
2022-06-20 17:51:59 +02:00
Sébastien Villemot
a2d0ac3586
Bytecode: remove unused expression types
2022-06-17 16:32:59 +02:00
Sébastien Villemot
0719f749e7
Bytecode: remove unused opcodes
2022-06-17 16:32:50 +02:00
Sébastien Villemot
3cc4aeb826
Preprocessor: split CodeInterpreter.hh into two headers
2022-06-16 18:05:00 +02:00
Sébastien Villemot
06f665e231
Perfect foresight: LBJ now available under stack_solve_algo=1 (with/without block/bytecode)
...
Previously, LBJ was available:
– under stack_solve_algo=6 when neither block nor bytecode were present
– under stack_solve_algo=1 with either block or bytecode (but the documentation
was not making it clear that it was LBJ)
This commit merges the two values for the option, and makes them
interchangeable. LBJ should now be invoked with stack_solve_algo=1 (but
stack_solve_algo=6 is kept for compatibility, and is a synonymous).
2022-06-15 15:06:33 +02:00
Sébastien Villemot
9cc5a5576e
Bytecode: some clean ups around checks for “stack_solve_algo” value
2022-06-15 14:28:41 +02:00
Sébastien Villemot
5db070e9dd
Bytecode: fix inconsistency in memory manager
...
The variable “gap” is compared to zero, so the intent probably was that it
could be negative. But size_t is an unsigned type. Rather use a signed type.
2022-06-07 17:26:45 +02:00
Sébastien Villemot
41ccfd4068
Bytecode: use braces (instead of $ and £) to highlight floating-point errors in expressions
2022-05-05 17:10:27 +02:00
Sébastien Villemot
b4ce69db3a
Remove options_.slowc field
...
There was no user interface, and the feature that it provides has lost
relevance over time.
Note that algorithms for block and/or bytecode still internally use some
equivalent of this parameter, but its initial value will no longer be
modifiable (which could lead to bugs, see commit
e49e7e906f
).
2022-03-31 17:39:43 +02:00
Sébastien Villemot
2d73ae2971
Bytecode: fix typo
2022-03-16 15:00:09 +01:00
Sébastien Villemot
96fb676be7
Bytecode: fix stack_solve_algo=4 when a “solve backward/forward” block follows a “solve two boundaries” block
...
When solving a “Solve two boundarise” block with stack_solve_algo=4, the
“slowc” variable is modified. This would affect the resolution of further
“solve backward/forward” blocks, which would yield results.
The fix consists in saving and restoring “slowc”.
2022-03-15 17:42:03 +01:00
Sébastien Villemot
65e18fe883
Bytecode: fix stack_solve_algo=4 on linear blocks
...
Only one iteration is performed on linear blocks. But in the case of
stack_solve_algo=4 it is not enough, since it will not find the right optimal
path lenght at the first iteration (even though that optimal path length is
ufnitary).
2022-03-01 11:29:29 +01:00
Sébastien Villemot
dbbbb75874
Bytecode: fix typo, replace “substract” by “subtract”
2022-02-28 18:47:20 +01:00
Sébastien Villemot
67a003aa73
Bytecode: fix stack_solve_algo=1 (relaxation method)
...
There were various issues with the construction of sparse submatrices.
By the way, refactor and document the code to make it more readable.
2022-02-28 18:47:20 +01:00
Sébastien Villemot
811e53f9ad
Bytecode: document matrix computation routines
2022-02-28 18:47:20 +01:00
Sébastien Villemot
59b8ee9c33
Bytecode: remove unused matrix subtraction routine
2022-02-28 18:47:20 +01:00
Sébastien Villemot
a7cc466285
Bytecode: fix bug in sparse matrix multiplication routines
...
Since those routines compute Aᵀ·B, the number of rows of the output is equal to
the number of columns of A.
2022-02-28 12:18:58 +01:00
Sébastien Villemot
8536b63827
Bytecode: remove superfluous debug information
2022-02-18 14:17:37 +01:00
Sébastien Villemot
972461c326
Bytecode: add debugging information about input arguments
2022-02-17 17:41:10 +01:00
Sébastien Villemot
a376d8c9fe
Fix steady state computation with bytecode+block and solve_algo ⩽ 4 or ⩾ 9
...
– Temporary terms were not correctly passed between blocks
– solve_algo ⩾ 9 was incorrectly passed through bytecode own’s solver instead
of through dynare_solve
2022-02-17 17:28:37 +01:00
Sébastien Villemot
ceb3ec2487
Bytecode: remove unused constructors
2022-02-15 16:54:41 +01:00
Sébastien Villemot
863fa2de1c
Bytecode: perfect foresight simulation of *linear* “Solve forward simple/complete” blocks was giving was results
2022-02-15 16:54:41 +01:00
Sébastien Villemot
803e3721ec
Bytecode: correctly handle M_.{endo_names,exo_names,param_names}, which are now cell arrays
2022-02-14 15:06:07 +01:00
Sébastien Villemot
92e82cfa0a
Bytecode: remove unused function prototype
2022-02-14 14:40:34 +01:00
Sébastien Villemot
188df7711d
Bytecode: fix simulation of blocks “Solve forward/backward complete” with stack_solve_algo={0,1,4}
...
The problem would also manifest at steady state computation with solve_algo=6.
It could crash or give incorrect results.
2022-02-11 12:00:25 +01:00
Sébastien Villemot
d74cb031d2
Bytecode: fix error message about convergence failure that can happen in Solve Backward Complete as well
2022-02-10 17:27:07 +01:00
Sébastien Villemot
cdb4f872b2
Bytecode: fix crash with stack_solve_algo=1 on “Solve forward/backward” blocks
2022-02-10 17:15:24 +01:00
Sébastien Villemot
ef6e4c7745
Bytecode: remove unused code
2022-02-10 16:58:39 +01:00
Sébastien Villemot
0caefa1593
Bytecode: exit gracefully when M_ does not exist
2022-02-09 14:32:25 +01:00
Sébastien Villemot
5f675eee18
Add erfc() primitive
2021-12-07 17:00:59 +01:00
Sébastien Villemot
271d80abee
Bytecode: release the lock on dynamic.bin when an exception occurs
...
Closes : #1815
2021-09-20 17:28:43 +02:00
Sébastien Villemot
766fff88f6
Use secure URL for link to GNU licenses
2021-06-09 17:35:05 +02:00
Sébastien Villemot
1a0ee5f055
Bytecode / sparse transpose: bug fix
...
The Jc vector has n+1 elements, where n is the number of columns. Moreover, the
size passed to memset() was wrong.
2021-02-09 16:05:11 +01:00
Sébastien Villemot
c9f6d3a626
Bytecode: more simplifications and modernizations
2021-02-09 16:00:53 +01:00
Sébastien Villemot
4a1dbc5ca4
Bytecode: fix bug introduced in previous commit
...
map::at() does bound checking, and throws an exception if out-of-range,
contrary to [] operator which returns a new element.
2021-02-03 19:52:25 +01:00
Sébastien Villemot
4893f0e82c
Bytecode: various simplifications and modernizations
2021-02-03 18:10:31 +01:00
Sébastien Villemot
30cfb0b03c
Bytecode: bugfix in conditional forecast
2021-02-01 17:54:36 +01:00
Sébastien Villemot
967966876f
Bytecode: remove obsolete LINBCG stuff
2021-02-01 15:26:33 +01:00
Sébastien Villemot
743469bfd7
Bytecode: remove stuff for creating a standalone debugging executable
...
This code no longer compiles. And it’s possible to debug the MEX directly.
2021-02-01 15:26:33 +01:00
Sébastien Villemot
bb5f58f55f
Bytecode: remove useless constant redefinition
2021-02-01 15:26:33 +01:00
Sébastien Villemot
eb29dc003a
Bytecode: remove CUDA-specific stuff
2021-02-01 15:26:31 +01:00
Sébastien Villemot
5ef440ad9b
Bytecode: remove MSVC++ specific portions
2021-02-01 14:50:46 +01:00
Sébastien Villemot
f9f50ff19a
Bytecode: port to C++11 using keyword
...
Performed using modernize-use-using from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-using.html
2021-02-01 14:50:46 +01:00
Sébastien Villemot
47357bb432
Bytecode: port to C++11 nullptr keyword
...
Performed using modernize-use-nullptr from clang-tidy.
Manual intervention to remove old-style C casts to nullptr.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-02-01 14:50:42 +01:00
Sébastien Villemot
a2186b06b8
Bytecode: port to C++11 syntax for default constructors
...
Performed using modernize-use-equals-default from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html
2021-02-01 14:50:42 +01:00
Sébastien Villemot
1aa0286f6d
Bytecode: port to C++11 emplace_back() method on containers
...
Performed using modernize-use-emplace from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html
2021-02-01 14:50:42 +01:00
Sébastien Villemot
93c6cb1c3c
Bytecode: use bool literals
...
Performed using modernize-use-bool-literals from clang-tidy
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html
2021-02-01 14:50:42 +01:00
Sébastien Villemot
1a4340cb80
Bytecode: port to C++11 auto keyword
...
Performed using modernize-use-auto from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html
2021-02-01 14:50:39 +01:00
Sébastien Villemot
63e922f637
Bytecode: port some constructors to pass-by-value using C++11 move semantics
...
Performed using modernize-pass-by-value from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html
2021-02-01 14:50:10 +01:00
Sébastien Villemot
7840d1396e
Bytecode: port to C++11 range-based for loops
...
Performed using modernize-loop-convert from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html
2021-02-01 14:50:07 +01:00
Sébastien Villemot
2f587cf5c3
Bytecode: use C++ headers
...
Performed using modernize-deprecated-headers from clang-tidy.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-deprecated-headers.html
2021-02-01 12:28:50 +01:00
Sébastien Villemot
c050325e3d
Bytecode: C++17 modernization / convert the remaining enums to enum classes
2021-02-01 12:10:47 +01:00
Sébastien Villemot
73253a0620
Bytecode + Block decomposition: fix crash with purely forward variables
...
After simulating a block containing purely forward variables (thus of type
“evaluate backward”), the it_ variable of the evaluator would be left in an
inconsistent state (typically 0, which means that taking the value of a lagged
variable would lead to an invalid read).
By the way, fix a symmetric problem for backward blocks (which could
potentially create a invalid read for purely backward models).
Ref. #1727
2020-09-22 16:45:44 +02:00
Sébastien Villemot
8803bc1479
Bytecode: minor improvement to debugging information
2020-09-22 16:42:33 +02:00
Sébastien Villemot
31a9a5e9ab
Bytecode MEX: various fixes to debug mode
2020-05-13 12:22:20 +02:00
Sébastien Villemot
f4f296edd6
Preprocessor update
...
— various refactoring and bugfixes in block decomposition
— small bugfix for PAC models
2020-05-06 18:17:25 +02:00
Sébastien Villemot
fbfff18378
Preprocessor: various refactorings of block decomposition
...
Adapt bytecode MEX accordingly.
2020-03-20 18:51:37 +01:00
Sébastien Villemot
7e770f69e7
Remove workaround for errors in MEX files
...
Because at some point throwing exceptions from MEX files (with mexErrMsgTxt())
was not working under Windows 64-bit, we had designed a workaround to avoid
using exceptions.
Most MEX files were returning an error code as their first (or sometimes last)
argument, and that code would have to be checked from the MATLAB code.
Since this workaround is no longer needed, this commit removes it. As a
consequence, the interface of many MEX files is modified.
For some background, see https://www.dynare.org/pipermail/dev/2010-September/000895.html
2020-01-10 18:33:11 +01:00
Sébastien Villemot
b901b7af86
Global reindentation of MEX sources
2019-12-20 16:30:24 +01:00
Sébastien Villemot
9e222734a8
Bytecode: fix logic in routine that substracts two sparse matrices
...
The logic of the dynSparseMatrix::Sparse_substract_SA_SB() routine was
incorrect.
In some cases, it would read past the last nonzero elements of the A matrix,
and consequently write past the number of allocated nonzero elements of the C
matrix.
This would lead to crashes and, probably, to wrong results under certain
circumstances.
Closes : #1652
2019-11-27 16:57:47 +01:00
Sébastien Villemot
7c39b12b7b
Always compile MEX files with OpenMP (when they can take advantage of it)
...
As a consequence, remove the --enable-openmp option of the configure script.
2019-06-25 17:26:17 +02:00
Sébastien Villemot
f5e2bfc30a
Ask GCC to warn about C-style casts (-Wold-style-cast)
...
Adapt the code accordingly.
2019-04-23 13:03:20 +02:00
Sébastien Villemot
57848930c6
Use Unicode copyright symbol (in UTF-8 encoding)
...
Do not use it in MATLAB source files, since unfortunately the MATLAB editor
does not support UTF-8.
2019-04-16 11:42:16 +02:00
Sébastien Villemot
ffb36e5713
Remove obsolete kludges for MinGW
2018-10-02 17:10:36 +02:00
Sébastien Villemot
d03cc56587
solve_algo=7 and stack_solve_algo=2 are now allowed under Octave
...
The gmres() function has been implemented (actually since Octave 3.4.1!).
2018-08-02 15:20:39 +02:00
Sébastien Villemot
932e5f946c
Update preprocessor submodule
...
Adapt bytecode DLL as a consequence.
2018-07-18 17:52:44 +02:00
Sébastien Villemot
b2c554623f
Various fixes related to the new layout of generated files
2018-06-28 18:14:40 +02:00
Sébastien Villemot
a1b8bd39b2
Move the location of various generated files on the filesystem
...
- M and MEX files are now under +${MODELNAME}/
- bytecode, C source and JSON now under ${MODELNAME}/model/
2018-06-27 17:03:39 +02:00
Sébastien Villemot
1ff5c3f571
Fix various typos (thanks lintian).
2017-06-28 15:06:54 +02:00
Ferhat Mihoubi
119e5b4dfa
Corrects bugs in bytecode related to the use of finite instead of isfinite and to mxMalloc tests
2017-06-05 18:51:43 +02:00
Stéphane Adjemian (Charybdis)
1bf81c9f5a
Fixed copyright notices.
2017-05-18 18:36:38 +02:00
Stéphane Adjemian (Charybdis)
b4448937cc
Fixed indentation of c/h/cc/hh files.
2017-05-16 16:30:27 +02:00
Stéphane Adjemian (Charybdis)
a53636e24e
Fixed copyright notices.
2017-05-16 14:11:15 +02:00
Ferhat Mihoubi
981e31c8c3
Fix issues in bytecode with option extended_path related to the size of endo_simul and exo_simul
...
(cherry picked from commit ab7acc49e30fbcb292d63d58281581a308716b4c)
2017-05-08 18:40:18 +02:00
Ferhat Mihoubi
e248d8bf59
Fix memory and periods issues in bytecode
...
(cherry picked from commit fa5dd681abcb3243a5ee9be1f71fdfc51bced1cd)
2017-05-08 18:39:44 +02:00
Ferhat Mihoubi
857fc3c4f4
Corrects several bugs related to bytecode:
...
- Memory allocation is checked
- The amount of memory allocated for conditional forecast is corrected
2017-04-05 11:48:40 +02:00
Stéphane Adjemian (Charybdis)
23642b3b6b
Defines M_PI, M_SQRT2 and finite() in bytecode...
...
... Which are not in standard C/C++ (otherwise compilation of the mex for Octave
with -std=c++11 fails).
2016-12-01 13:32:54 +01:00
Houtan Bastani
8b17af05d5
bytecode: work around for isnan and isinf bug in C++ standard, glibc <= 2.23.
...
Fixed by https://sourceware.org/bugzilla/show_bug.cgi?id=19439
2016-10-11 16:01:27 +02:00