diff --git a/dune/solvers/iterationsteps/projectedgradientstep.hh b/dune/solvers/iterationsteps/projectedgradientstep.hh index 24757b26c146f85e07844cd813da620c4e4b2528..1d80800b544cc994fd21dc016bbb5f55431d1b4b 100644 --- a/dune/solvers/iterationsteps/projectedgradientstep.hh +++ b/dune/solvers/iterationsteps/projectedgradientstep.hh @@ -34,8 +34,10 @@ public: //! Constructor that gets the quadratic energy functional x^T mat x - rhs^T*x, and the initial iterate ProjectedGradientStep(const MatrixType& mat, VectorType& x, const VectorType& rhs) - : Base(x), mat_(mat), rhs_(rhs) - {} + : Base(x), rhs_(&rhs) + { + mat_ = Dune::stackobject_to_shared_ptr(mat); + } /** \brief Compute the generalized Cauchy point along a given direction. This is sometimes needed in * nonlinear programming where this direction then corresponds to the gradient of the nonlinear function