Commit Graph

994 Commits (7dd2dd5e24a343fbeaf3522ea5e535c27d8b9f95)

Author SHA1 Message Date
NormannR c6d5c48ff7 Local state-space iteration at order 3: multi-thread 3rd-order version with and without pruning 2022-08-30 14:06:19 +02:00
Sébastien Villemot 24d7f569f1
Bytecode MEX: fix compilation under GCC ⩾ 11
Problem introduced in previous commit.
2022-07-29 14:30:45 +02:00
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 16eabbbc4e
block_trust_region MEX: improve treatment of non-square blocks in Dulmage-Mendelsohn decomposition
– before erroring out, check whether the residuals for the block are already
  zero (in which case, move to next block)
– improve error message that is printed otherwise

Note that trying to solve under-determined blocks (as in dynare_solve.m) would
require too many changes in the existing code, so let’s leave it out.

Closes: #1851
2022-07-22 12:43:38 +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 f454d1ae21
Bytecode MEX: build with -Wmaybe-unitialized 2022-07-20 15:10:40 +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 888a87312d
Enable -Wunused-parameter for C++ MEX
Except for libdynare++, since Dynare++ is not ready (and is probably not worth
fixing by adding [[maybe_unused]] tags).
2022-07-05 12:12:53 +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 218bb1a15f
k_order_welfare MEX: check number of arguments 2022-07-05 11:55:40 +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 5ccd5f2613
Revert "More explicit message when the Dulmage-Mendelsohn decomposition returns a non-square block"
This reverts commit fa71d4712d.

Ref. #1851
2022-06-16 18:05:14 +02:00
Sébastien Villemot 3cc4aeb826
Preprocessor: split CodeInterpreter.hh into two headers 2022-06-16 18:05:00 +02:00
Sébastien Villemot fa71d4712d
More explicit message when the Dulmage-Mendelsohn decomposition returns a non-square block
Closes: #1851
2022-06-16 15:53:45 +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 dfcfdda318
Enable more compiler warnings for C++ 2022-06-07 18:01:58 +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
Stéphane Adjemian (Ryûk) f7204e6ec8
Bug fix (pruning at second order in estimation).
Closes #1853.
2022-05-13 11:39:49 +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 cc8b2fd920
Bump to C++20 standard (with GNU extensions)
In practice, for the time being, we limit ourselves to C++20 features available
in GCC 10.
2022-05-04 18:33:07 +02:00
Sébastien Villemot ce2c1e0d30
No longer use C++ UTF-8 string literals
They don’t bring any added value, and break compilation in C++20 mode (because
they are then of type “const char8_t *” which is distinct from “const char *”).
2022-05-04 18:32:52 +02:00
Sébastien Villemot 2f6120de0c
Octave 7 compatibility fix: add --link-stand-alone when getting LDFLAGS from mkoctfile
Since Octave 7, LDFLAGS as returned by mkoctfile include -shared, which is
undesirable for generic LDFLAGS. Pass the --link-stand-alone option to strip
this flag.
2022-04-15 14:32:54 +02:00
Sébastien Villemot 10af04c6d8
Use Unicode copyright symbol (in UTF-8 encoding) in all source files
It is now supported by the MATLAB editor (as of R2022a).

The old ASCII notation is left in some files that we copy as-is from other
sources (e.g. in the contrib/ and m4/ subdirectories).

The particles submodule is not updated at this point, because it is in an
inconsistent state.

[skip ci]
2022-04-13 14:54:25 +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 c5a3658110
Block trust region: cosmetics
In particular, avoid using the deprecated dble() function. Rather use the
real() cast function, with the appropriate kind parameter.
2022-03-29 10:34:35 +02:00
Stéphane Adjemian (Ryûk) b9bc1e7cb1
Revert update if residuals or jacobian have NaNs (block_trust_region). 2022-03-25 19:42:40 +01:00
Stéphane Adjemian (Ryûk) 79cad99446
Harmonise exit codes and fix convergence test. 2022-03-25 19:42:40 +01:00
Stéphane Adjemian (Ryûk) f2bf98ee76
Return the value of info as a third argument (block_trust_region). 2022-03-25 19:42:40 +01:00
Sébastien Villemot 8c16d1745e
block_trust_region MEX: first part of handling complex values returned by solved function
If solved function returns complex values (with nonzero imaginary part), turn
them into NaNs. This mimics the behaviour of the use_dll case.

Next step will be to adapt the trust region algorithm to diminish radius when
there are NaNs.

Incidentally, bump the required GCC version to 9, since we use the %re and %im
components of complex values in Fortran.
2022-03-21 18:55:42 +01:00