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

This option could crash or give wrong results.

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

Closes: #1804
pac-components
Sébastien Villemot 2021-08-31 12:34:44 +02:00
parent 55850f465d
commit 5eb769008b
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 2 additions and 2 deletions

View File

@ -154,7 +154,7 @@ Approximation::walkStochSteady()
JournalRecordPair pa(journal);
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
/* We form the DRFixPoint object from the last rule with σ=dsigma. Then
@ -180,7 +180,7 @@ Approximation::walkStochSteady()
minus the old steady state. Then we create StochForwardDerivs object,
which calculates the derivatives of g** expectations at new sigma and
new steady. */
Vector dy(model.getSteady());
Vector dy(const_cast<const Vector &>(model.getSteady()));
dy.add(-1.0, last_steady);
StochForwardDerivs<Storage::fold> hh(ypart, model.nexog(), *rule_ders_ss, mom, dy,