diff --git a/ql/math/interpolations/xabrinterpolation.hpp b/ql/math/interpolations/xabrinterpolation.hpp index 5407e455109..080c6824386 100644 --- a/ql/math/interpolations/xabrinterpolation.hpp +++ b/ql/math/interpolations/xabrinterpolation.hpp @@ -137,8 +137,8 @@ class XABRInterpolationImpl : public Interpolation::templateImpl, // we must update weights if it is vegaWeighted if (vegaWeighted_) { - std::vector::const_iterator x = this->xBegin_; - std::vector::const_iterator y = this->yBegin_; + I1 x = this->xBegin_; + I2 y = this->yBegin_; // std::vector::iterator w = weights_.begin(); this->weights_.clear(); Real weightsSum = 0.0; @@ -244,8 +244,8 @@ class XABRInterpolationImpl : public Interpolation::templateImpl, // calculate total squared weighted difference (L2 norm) Real interpolationSquaredError() const { Real error, totalError = 0.0; - std::vector::const_iterator x = this->xBegin_; - std::vector::const_iterator y = this->yBegin_; + I1 x = this->xBegin_; + I2 y = this->yBegin_; std::vector::const_iterator w = this->weights_.begin(); for (; x != this->xEnd_; ++x, ++y, ++w) { error = (value(*x) - *y); @@ -257,9 +257,9 @@ class XABRInterpolationImpl : public Interpolation::templateImpl, // calculate weighted differences Disposable interpolationErrors() const { Array results(this->xEnd_ - this->xBegin_); - std::vector::const_iterator x = this->xBegin_; + I1 x = this->xBegin_; Array::iterator r = results.begin(); - std::vector::const_iterator y = this->yBegin_; + I2 y = this->yBegin_; std::vector::const_iterator w = this->weights_.begin(); for (; x != this->xEnd_; ++x, ++r, ++w, ++y) { *r = (value(*x) - *y) * std::sqrt(*w); diff --git a/ql/math/optimization/simplex.hpp b/ql/math/optimization/simplex.hpp index e637c3bcfec..ec9e8f43ae2 100644 --- a/ql/math/optimization/simplex.hpp +++ b/ql/math/optimization/simplex.hpp @@ -61,6 +61,8 @@ namespace QuantLib { Simplex(Real lambda) : lambda_(lambda) {} virtual EndCriteria::Type minimize(Problem& P, const EndCriteria& endCriteria); + Real lambda() const { return lambda_; } + private: Real extrapolate(Problem& P, Size iHighest, diff --git a/ql/pricingengines/inflation/inflationcapfloorengines.hpp b/ql/pricingengines/inflation/inflationcapfloorengines.hpp index ab5f5f7a377..10f7d40e002 100644 --- a/ql/pricingengines/inflation/inflationcapfloorengines.hpp +++ b/ql/pricingengines/inflation/inflationcapfloorengines.hpp @@ -49,6 +49,7 @@ namespace QuantLib { ext::shared_ptr index() const { return index_;} Handle volatility() const { return volatility_; } + Handle nominalTermStructure() const { return nominalTermStructure_; } void setVolatility(const Handle& vol); diff --git a/ql/termstructures/iterativebootstrap.hpp b/ql/termstructures/iterativebootstrap.hpp index a56d02354c4..1817ef4b208 100644 --- a/ql/termstructures/iterativebootstrap.hpp +++ b/ql/termstructures/iterativebootstrap.hpp @@ -215,6 +215,7 @@ namespace detail { // because, e.g., of interpolation's early checks ts_->data_ = std::vector(alive_+1, Traits::initialValue(ts_)); previousData_.resize(alive_+1); + validCurve_ = false; } initialized_ = true; } diff --git a/ql/timegrid.hpp b/ql/timegrid.hpp index c5deac039fa..350cf80a406 100644 --- a/ql/timegrid.hpp +++ b/ql/timegrid.hpp @@ -120,12 +120,9 @@ namespace QuantLib { ++t) { Time periodEnd = *t; if (periodEnd != 0.0) { - // the nearest integer - Size nSteps = Size((periodEnd - periodBegin)/dtMax+0.5); - // at least one time step! - nSteps = (nSteps!=0 ? nSteps : 1); + // the nearest integer, at least 1 + Size nSteps = std::max(Size((periodEnd - periodBegin)/dtMax+0.5), Size(1)); Time dt = (periodEnd - periodBegin)/nSteps; - times_.reserve(nSteps); for (Size n=1; n<=nSteps; ++n) times_.push_back(periodBegin + n*dt); }