Commit Graph

15031 Commits (7dd2dd5e24a343fbeaf3522ea5e535c27d8b9f95)

Author SHA1 Message Date
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) 53324aad69
Return initial guess if trust_region fails. 2022-03-26 09:21:25 +01:00
Stéphane Adjemian (Ryûk) cdd85f32a7
Update unit tests for trust region routines. 2022-03-25 19:42:40 +01: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) 4cccdd9074
Bug fix. Revert to previous Jacobian matrix if updated one is ill-behaved. 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
Stéphane Adjemian (Ryûk) 24d5ba0290
Change nonlinear solvers in some integration tests.
Trust region with block decomposition (as provided by dmperm) fails to provide
correct simulations (most likely due to the interpretation of tolf which
depends on the number and size of blocks).
2022-03-25 19:42:40 +01:00
Stéphane Adjemian (Ryûk) aa8439d4cc
New implementation of the trust region algorithm.
Main difference is the presence of traps for NaN/Inf/Complex numbers in
residuals or the Jacobian matrix. Also added new unit tests.
2022-03-25 19:42:40 +01:00
Stéphane Adjemian (Ryûk) 1b2b3db380
Fix definition of the Rosenbrock function. 2022-03-25 19:42:40 +01:00
Sébastien Villemot 968eb28771 Merge branch 'fortran_not' into 'master'
perfect_foresight_solver_core.m: fix Fortran not

See merge request Dynare/dynare!2011
2022-03-25 13:34:08 +00:00
Johannes Pfeifer 1ed765b8c4 perfect_foresight_solver_core.m: fix Fortran not 2022-03-25 14:23:11 +01:00
Sébastien Villemot facab0f81b
Merge branch 'mom' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2008
2022-03-25 12:51:40 +01:00
Sébastien Villemot e49e7e906f
Forbid changing the value of “slowc” if “block” or “bytecode” is used
The code is buggy and leads to wrong results, so forbid this combination.
2022-03-25 12:36:36 +01:00
Sébastien Villemot 014a3c3f2e
Merge branch 'sensitivity' of git.dynare.org:JohannesPfeifer/dynare
Ref. !2009
2022-03-24 17:53:34 +01:00
Sébastien Villemot 9a4e08fe15
CI: bump to MATLAB R2022a 2022-03-24 17:44:51 +01:00
Sébastien Villemot b31fe76dfd
Provisions for MATLAB R2022a 2022-03-24 17:43:40 +01:00
Johannes Pfeifer f3bf8fb814 MOM: add missing debug option 2022-03-24 15:28:03 +01:00
Sébastien Villemot 7f58ec5963
Testsuite: increase tolerance in block_bytecode/lola_solve_one_boundary_mfs2.mod
This is made necessary by commit dd1ec10ec8.
2022-03-24 14:18:18 +01:00
Johannes Pfeifer a1ebd20a88 dynare_sensitivity.m: provide warning if order is reset 2022-03-24 13:02:25 +01:00
Sébastien Villemot 4da9d1e718
Block (without bytecode): avoid silent failures in some corner cases
Either ensure that oo_.determinstic_simulation.status is set, or really error out.
2022-03-23 17:33:37 +01:00
Sébastien Villemot dd1ec10ec8
Block (without bytecode): use dynatol.f as convergence criterion for perfect foresight
Was incorrectly using solve_tolf.
2022-03-23 17:25:32 +01:00
Sébastien Villemot e5f4d96c71
Fix typo 2022-03-23 16:58:59 +01:00
Sébastien Villemot bef8d80ba8
More conversions to logical values 2022-03-23 16:52:40 +01:00
Sébastien Villemot 79df767314
Bump JSONLab to version 2.0
We were previously using version 1.8.
2022-03-23 15:01:55 +01:00
Sébastien Villemot 35bdac6be6
Testsuite: in block_bytecode/ireland.mod, remove unneeded option setting
The default of options_.slowc is already 1.
2022-03-22 12:53:04 +01:00
Sébastien Villemot b43f9af7d1
Windows package: minor build system simplification
The “all” rule being equivalent to the “build” rule, juste delete the former
and move the latter upwards.
2022-03-22 12:11:44 +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
Sébastien Villemot d5472d2338
Tighten input sanity checks of various MEX files
Note that the unitary test in lyapunov_solver.m that checks sparse matrix input
had to be removed. Previously, this test was passing by chance (because the
sparse test matrices had actually no zero element, hence the internal double
float storage was the same as in the dense case). Now it consistently fails
with the additional checks in disclyap_fast MEX.
2022-03-18 22:49:46 +01:00
Sébastien Villemot 4f6d8a198a
k_order_perturbation MEX: convert complex elements of residuals or derivatives matrices to NaNs 2022-03-18 16:45:33 +01:00
Sébastien Villemot d8c3467a08
Testsuite: improve tests for block/bytecode options
Improve the model that is used to test all combinations of algorithms with
block and bytecode options, by ensuring that it includes the 8 possible types of blocks:
– Solve {forward, backward, two boundaries} {simple, complete}
– Evaluate {forward, backward}

All the “Solve” blocks are also included in both linear and nonlinear forms
(since the codepaths are typically different depending on the linearity of
the block).

Note that there is no such thing as a nonlinear “Evaluate” block, since the
endogenous variables of the block always enter linearly (on the LHS).

Also:
- use perfect_foresight_{setup,solver} instead of simul (and disable automatic homotopy)
- add a shock on e_R (though this is not strictly needed since the
  corresponding block already inherits the shock from another ancestor block)
- remove the block for observables, there is already another block of type
  “Evaluate forward”
2022-03-16 15:00:09 +01:00
Sébastien Villemot 07978affa5
Block decomposition: simplify MATLAB implementation of stack_solve_algo=3 (BiCGStab)
This commit makes it closer to the implementation in bytecode. In practice,
this change fixes convergence problems on some models.
2022-03-16 15:00:09 +01:00
Sébastien Villemot db5e04107f
solve_one_boundary.m: fix crash in verbose mode 2022-03-16 15:00:09 +01:00
Sébastien Villemot 2d73ae2971
Bytecode: fix typo 2022-03-16 15:00:09 +01:00
Sébastien Villemot 8a6ea14402 Merge branch 'doc_naming' into 'master'
Manual: clarify potential naming issues in steady state files

See merge request Dynare/dynare!2007
2022-03-15 16:43:22 +00:00
Sébastien Villemot 3a039a1d7f
Preprocessor: fix detection of nonlinearity of blocks of type “Solve backward/forward simple” 2022-03-15 17:42:03 +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
Johannes Pfeifer ecbfb7d083 Manual: clarify potential naming issues in steady state files 2022-03-14 20:33:19 +01:00
Sébastien Villemot 52dfad35f9 Merge branch 'selec_draws' into 'master'
posterior moments: fix bugs that cause crashes

See merge request Dynare/dynare!2006
2022-03-14 15:16:57 +00:00
Johannes Pfeifer 28536314c0 posterior moments: fix bugs that cause crashes
- Delete non-existing output argument
- prevent info from being overwritten
2022-03-14 14:50:49 +01:00
Stéphane Adjemian (Ryûk) 882091cc97
Return more info about nonlinear solver failures (solve1). 2022-03-03 22:30:38 +01:00
Stéphane Adjemian (Ryûk) 7072359241
Fix fifth output introduced in e815fb2 (exitflag was not updated). 2022-03-03 21:56:44 +01:00
Stéphane Adjemian (Ryûk) afd8359dbf
Do not compute g twice in solve1.
When jacobian is evaluated numerically.
2022-03-03 20:26:06 +01:00
Stéphane Adjemian (Ryûk) 9be328aeda
Cosmetic changes. 2022-03-03 20:24:18 +01:00
Stéphane Adjemian (Ryûk) f2193e8ec8
Add more checks on the initial evaluation. 2022-03-03 18:33:34 +01:00
Stéphane Adjemian (Ryûk) 3c85695b99
Use isinf() instead of isfinite() in solve1 routine. 2022-03-03 18:30:36 +01:00
Stéphane Adjemian (Ryûk) e815fb2901
Display exitflag returned by fsolve.
When the Newton fails in the simulation of backward models.
2022-03-03 18:19:33 +01:00
Stéphane Adjemian (Ryûk) e6592b3943
Display more info if Newton fails in backward model simulations. 2022-03-03 16:57:59 +01:00
Stéphane Adjemian (Ryûk) 7ee124bbba
Fix bug.
Return the paths for the endogenous only before the nonlinear solver crash.
2022-03-03 10:57:40 +01:00
Stéphane Adjemian (Charybdis) 90ae54a6ff
Translate to English. 2022-03-03 09:35:30 +01:00