Sparse representation: fix bug in output of indices in driver and JSON files
It would previously forget to write the indices for the highest derivation order (e.g. if order=3, then it would only write sparce indices up to 2nd order). Ref. dynare#1859master
parent
c721718bf6
commit
83bfc792af
|
@ -2242,7 +2242,7 @@ ModelTree::writeDriverSparseIndicesHelper(ostream &output) const
|
|||
output << "]);" << endl;
|
||||
|
||||
// Write indices for the sparse higher-order derivatives
|
||||
for (int i {2}; i < computed_derivs_order; i++)
|
||||
for (int i {2}; i <= computed_derivs_order; i++)
|
||||
{
|
||||
output << "M_." << model_name << "_g" << i << "_sparse_indices = int32([";
|
||||
for (const auto &[vidx, d] : derivatives[i])
|
||||
|
@ -2292,7 +2292,7 @@ ModelTree::writeJsonSparseIndicesHelper(ostream &output) const
|
|||
output << ']' << endl;
|
||||
|
||||
// Write indices for the sparse higher-order derivatives
|
||||
for (int i {2}; i < computed_derivs_order; i++)
|
||||
for (int i {2}; i <= computed_derivs_order; i++)
|
||||
{
|
||||
output << R"(, ")" << model_name << "_g" << i << R"(_sparse_indices": [)";
|
||||
for (bool printed_something {false};
|
||||
|
|
Loading…
Reference in New Issue