– 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
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.
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.
- block trust region solver now available under solve_algo=13
It is essentially the same as solve_algo=4, except that Jacobian by finite
difference is not handled. A test file is added for that case
- block trust region solver with shortcut for equations that can be evaluated
is now available under solve_algo=14 (in replacement of the pure-MATLAB solver)
Closes: Enterprise/dynare#3
This MEX solves nonlinear systems of equations using a trust region algorithm.
The problem is subdivided in smaller problems by doing a block
triangularisation of the Jacobian at the guess value, using the
Dulmage-Mendelsohn algorithm.
The interface of the MEX is simply:
[x, info] = block_trust_region(f, guess_value);
Where f is either a function handle or a string designating a function.
f must take one argument (the evaluation point), and return either one or two
arguments (the residuals and, optionally, the Jacobian).
On success, info=0; on failure, info=1.