If auxiliary variables were created *before* the Lagrange multipliers (e.g. aux
vars related to the expectation or diff operators), then the vector of
residuals of the reduced Ramsey steady state problem (with respect to original
variables, as computed by the dyn_ramsey_static_1 subfunction) was incorrect.
– 🐛 Incorrect stochastic transformation with endo lead ⩾ 2 or exo lead ⩾ 1 in
external functions
– New solution for solving the Ramsey steady state with Lagrange multipliers
with lead or lag ⩾ 2. Now generates a dedicated file for derivatives of static
model w.r.t. multipliers using chain rule derivation (#633, #1119, #1133)
– 🐛 Incorrect cost table used when computing temporary terms in static model
with “use_dll”
– 🐛 Crash when writing the (static) set_auxiliary_variables file in the
presence of external functions
We also take advantage of the fact that the non-block version is always
available next to the block one, so when we are only interested in the residual
as a whole, we simplify by using the non-block version.
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
In case of no steady state file, they are identical, but with a steady state file, they are not. Moreover, this fixes a problem with the dimension of the input to the steady state file. ys was not initialized and had wrong dimensions
Also adds comments to file.
The x returned by a steady state file includes Lagrange multipliers. When starting with 0 multipliers, the steady state of the multipliers is computed correctly. But when running it a second time like in a subsequent call to stoch_simul, the algorithm thinks that elements of xx are 0 which they aren't. As a result, it finds minus the multiplier as the solution, resulting in an output of 0 for all multipliers.
Also makes sure that the check flag is returned and the steady state file always called if it exists. Otherwise, parameters might not be updated and NaN not detected.
If the steady state file was modifying parameters, the changes were not taken
fully taken into account.
Thanks to Junior Maih for noticing and proposing the fix.