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

Dynare++: fix bug in the --steps option

This option could crash or give wrong results.

Bug introduced in 6d99b6d1.
The Vector(Vector &) and Vector(const Vector &) constructors are not
equivalent.

Closes: #1804
parent 55850f46
No related branches found
No related tags found
No related merge requests found
...@@ -154,7 +154,7 @@ Approximation::walkStochSteady() ...@@ -154,7 +154,7 @@ Approximation::walkStochSteady()
JournalRecordPair pa(journal); JournalRecordPair pa(journal);
pa << "Approximation about stochastic steady for sigma=" << sigma_so_far+dsigma << endrec; pa << "Approximation about stochastic steady for sigma=" << sigma_so_far+dsigma << endrec;
Vector last_steady(model.getSteady()); Vector last_steady(const_cast<const Vector &>(model.getSteady()));
// calculate fix-point of the last rule for ‘dsigma’ // calculate fix-point of the last rule for ‘dsigma’
/* We form the DRFixPoint object from the last rule with σ=dsigma. Then /* We form the DRFixPoint object from the last rule with σ=dsigma. Then
...@@ -180,7 +180,7 @@ Approximation::walkStochSteady() ...@@ -180,7 +180,7 @@ Approximation::walkStochSteady()
minus the old steady state. Then we create StochForwardDerivs object, minus the old steady state. Then we create StochForwardDerivs object,
which calculates the derivatives of g** expectations at new sigma and which calculates the derivatives of g** expectations at new sigma and
new steady. */ new steady. */
Vector dy(model.getSteady()); Vector dy(const_cast<const Vector &>(model.getSteady()));
dy.add(-1.0, last_steady); dy.add(-1.0, last_steady);
StochForwardDerivs<Storage::fold> hh(ypart, model.nexog(), *rule_ders_ss, mom, dy, StochForwardDerivs<Storage::fold> hh(ypart, model.nexog(), *rule_ders_ss, mom, dy,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment