Skip to content
Snippets Groups Projects
Verified Commit c785a81d authored by Sébastien Villemot's avatar Sébastien Villemot
Browse files

k-order MEX: fix crash on Octave when higher-order derivatives have numerical zero

In Octave, when some values given to the sparse() function are numerically
zero, then the nzmax of the generated sparse matrix is shrinked accordingly;
while under MATLAB, the nzmax is the length of the vector of values, zeros
included.

The check at the top of
DynamicModelMFile::unpackSparseMatrixAndCopyIntoTwoDMatData() would then fail
under Octave if some higher-derivatives had an element which is symbolically
non-zero but numerically zero.

We therefore relax the check, and accordingly adapt the code that handles
numerical zeros.

This bug was uncovered by tests/pruning/AnSchorfheide_pruned_state_space.mod,
which was failing under Octave.

(cherry picked from commit 144bdf34)
parent baf44191
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment