Re: [QuantLib-svn] SF.net SVN: quantlib:[17823] trunk/QuantLib/ql

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib:[17823] trunk/QuantLib/ql

Luigi Ballabio

On Jun 29, 2011, at 8:01 PM, [hidden email] wrote:

> Revision: 17823
>          http://quantlib.svn.sourceforge.net/quantlib/?rev=17823&view=rev
> Author:   nando
> Date:     2011-06-29 18:01:02 +0000 (Wed, 29 Jun 2011)
>
> Log Message:
> -----------
> - changed guess signature to allow for a more compact and clear  
> iterative bootstrap algorithm
> - changed signature of minValueAfter and maxValueAfter to include  
> the curve pointer and validData information: this will allow more  
> effective bracketing

Sorry, it breaks backwards compatibility.  We'll have to think how to  
go about this, and it's ok to leave it for the time being, but it will  
have to be reverted.

Luigi



>
> Modified Paths:
> --------------
>    trunk/QuantLib/ql/experimental/inflation/
> piecewiseyoyoptionletvolatility.hpp
>    trunk/QuantLib/ql/termstructures/credit/probabilitytraits.hpp
>    trunk/QuantLib/ql/termstructures/inflation/
> piecewiseyoyinflationcurve.hpp
>    trunk/QuantLib/ql/termstructures/inflation/
> piecewisezeroinflationcurve.hpp
>    trunk/QuantLib/ql/termstructures/iterativebootstrap.hpp
>    trunk/QuantLib/ql/termstructures/localbootstrap.hpp
>    trunk/QuantLib/ql/termstructures/yield/bootstraptraits.hpp
>
> Modified: trunk/QuantLib/ql/experimental/inflation/
> piecewiseyoyoptionletvolatility.hpp
> ===================================================================
> --- trunk/QuantLib/ql/experimental/inflation/
> piecewiseyoyoptionletvolatility.hpp 2011-06-29 17:50:59 UTC (rev  
> 17822)
> +++ trunk/QuantLib/ql/experimental/inflation/
> piecewiseyoyoptionletvolatility.hpp 2011-06-29 18:01:02 UTC (rev  
> 17823)
> @@ -2,6 +2,7 @@
>
> /*
>  Copyright (C) 2009 Chris Kenyon
> + Copyright (C) 2011 Ferdinando Ametrano
>
>  This file is part of QuantLib, a free-software/open-source library
>  for financial quantitative analysts and developers - http://quantlib.org/
> @@ -46,19 +47,34 @@
>                                     // assumptions on early options
>                                     // that are _not_ quoted
>         }
> -        static Volatility initialGuess() {return 0.005;}
> -        static Volatility guess(const YoYOptionletVolatilitySurface*,
> -                                const Date &) {
> +
> +        template <class C>
> +        static Volatility guess(Size i,
> +                                const C* c,
> +                                bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return 0.005;
> +
> +            // could/should extrapolate
>             return 0.002;
>         }
> -        static Volatility minValueAfter(Size n,
> -                                        const  
> std::vector<Volatility> &v) {
> -            return std::max(0.0, v[n-1] - 0.02); // vol cannot be  
> negative
> +
> +        template <class C>
> +        static Volatility minValueAfter(Size i,
> +                                        const C* c,
> +                                        bool validData) {
> +            return std::max(0.0, c->data()[i-1] - 0.02); // vol  
> cannot be negative
>         }
> -        static Volatility maxValueAfter(Size n,
> -                                        const  
> std::vector<Volatility> &v) {
> -            return v[n-1] + 0.02;
> +        template <class C>
> +        static Volatility maxValueAfter(Size i,
> +                                        const C* c,
> +                                        bool validData) {
> +            return c->data()[i-1] + 0.02;
>         }
> +
>         static void updateGuess(std::vector<Volatility> &vols,
>                                 Volatility level,
>                                 Size i) {
> @@ -198,4 +214,3 @@
> }
>
> #endif
> -
>
> Modified: trunk/QuantLib/ql/termstructures/credit/
> probabilitytraits.hpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/credit/probabilitytraits.hpp
> 2011-06-29 17:50:59 UTC (rev 17822)
> +++ trunk/QuantLib/ql/termstructures/credit/probabilitytraits.hpp
> 2011-06-29 18:01:02 UTC (rev 17823)
> @@ -5,7 +5,7 @@
>  Copyright (C) 2008 Chris Kenyon
>  Copyright (C) 2008 Roland Lichters
>  Copyright (C) 2008 StatPro Italia srl
> - Copyright (C) 2009 Ferdinando Ametrano
> + Copyright (C) 2009, 2011 Ferdinando Ametrano
>
>  This file is part of QuantLib, a free-software/open-source library
>  for financial quantitative analysts and developers - http://quantlib.org/
> @@ -56,24 +56,37 @@
>         static Real initialValue(const  
> DefaultProbabilityTermStructure*) {
>             return 1.0;
>         }
> -        // initial guess
> -        static Real initialGuess() {
> -            return 1.0/(1.0+detail::avgHazardRate*0.25);
> -        }
> -        // further guesses
> -        static Real guess(const DefaultProbabilityTermStructure* c,
> -                          const Date& d) {
> +
> +        // guesses
> +        template <class C>
> +        static Real guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return 1.0/(1.0+detail::avgHazardRate*0.25);
> +
> +            // extrapolate
> +            Date d = c->dates()[i];
>             return c->survivalProbability(d,true);
>         }
> +
>         // possible constraints based on previous values
> -        static Real minValueAfter(Size,
> -                                  const std::vector<Real>&) {
> +        template <class C>
> +        static Real minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return QL_EPSILON;
>         }
> +        template <class C>
>         static Real maxValueAfter(Size i,
> -                                  const std::vector<Real>& data) {
> -            return data[i-1];
> +                                  const C* c,
> +                                  bool validData) {
> +            return c->data()[i-1];
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Real>& data,
>                                 Probability p,
> @@ -101,24 +114,39 @@
>         static Real initialValue(const  
> DefaultProbabilityTermStructure*) {
>             return detail::avgHazardRate;
>         }
> -        // initial guess
> -        static Real initialGuess() { return detail::avgHazardRate; }
> -        // further guesses
> -        static Real guess(const DefaultProbabilityTermStructure* c,
> -                          const Date& d) {
> +
> +        // guesses
> +        template <class C>
> +        static Real guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return detail::avgHazardRate;
> +
> +            // extrapolate
> +            Date d = c->dates()[i];
>             return c->hazardRate(d, true);
>         }
> +
>         // possible constraints based on previous values
> -        static Real minValueAfter(Size,
> -                                  const std::vector<Real>&) {
> +        template <class C>
> +        static Real minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return QL_EPSILON;
>         }
> -        static Real maxValueAfter(Size,
> -                                  const std::vector<Real>&) {
> +        template <class C>
> +        static Real maxValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             // no constraints.
>             // We choose as max a value very unlikely to be exceeded.
>             return 200.0;
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Real>& data,
>                                 Real rate,
> @@ -148,24 +176,39 @@
>         static Real initialValue(const  
> DefaultProbabilityTermStructure*) {
>             return detail::avgHazardRate;
>         }
> -        // initial guess
> -        static Real initialGuess() { return detail::avgHazardRate; }
> -        // further guesses
> -        static Real guess(const DefaultProbabilityTermStructure* c,
> -                          const Date& d) {
> +
> +        // guesses
> +        template <class C>
> +        static Real guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return detail::avgHazardRate;
> +
> +            // extrapolate
> +            Date d = c->dates()[i];
>             return c->defaultDensity(d, true);
>         }
> +
>         // possible constraints based on previous values
> -        static Real minValueAfter(Size,
> -                                  const std::vector<Real>&) {
> +        template <class C>
> +        static Real minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return QL_EPSILON;
>         }
> -        static Real maxValueAfter(Size,
> -                                  const std::vector<Real>&) {
> +        template <class C>
> +        static Real maxValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             // no constraints.
>             // We choose as max a value very unlikely to be exceeded.
>             return 3.0;
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Real>& data,
>                                 Real density,
> @@ -180,5 +223,4 @@
>
> }
>
> -
> #endif
>
> Modified: trunk/QuantLib/ql/termstructures/inflation/
> piecewiseyoyinflationcurve.hpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/inflation/
> piecewiseyoyinflationcurve.hpp 2011-06-29 17:50:59 UTC (rev 17822)
> +++ trunk/QuantLib/ql/termstructures/inflation/
> piecewiseyoyinflationcurve.hpp 2011-06-29 18:01:02 UTC (rev 17823)
> @@ -3,6 +3,7 @@
> /*
>  Copyright (C) 2007 Chris Kenyon
>  Copyright (C) 2007, 2008 StatPro Italia srl
> + Copyright (C) 2011 Ferdinando Ametrano
>
>  This file is part of QuantLib, a free-software/open-source library
>  for financial quantitative analysts and developers - http://quantlib.org/
> @@ -49,18 +50,36 @@
>         static Rate initialValue(const YoYInflationTermStructure* t) {
>             return t->baseRate();
>         }
> -        static Rate initialGuess() { return 0.02; }
> -        // further guesses
> -        static Rate guess(const YoYInflationTermStructure*, const  
> Date&) {
> +
> +        // guesses
> +        template <class C>
> +        static Rate guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return 0.02;    // initial guess at flat inflation
> +
> +            // could/should extrapolate
>             return 0.02;    // initial guess at flat inflation
>         }
> +
>         // possible constraints based on previous values
> -        static Rate minValueAfter(Size, const std::vector<Rate>&) {
> +        template <class C>
> +        static Rate minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return -0.3 + QL_EPSILON;
>         }
> -        static Rate maxValueAfter(Size, const std::vector<Rate>&) {
> +        template <class C>
> +        static Rate maxValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return 0.5 - QL_EPSILON;
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Rate>& data,
>                                 Rate level,
>
> Modified: trunk/QuantLib/ql/termstructures/inflation/
> piecewisezeroinflationcurve.hpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/inflation/
> piecewisezeroinflationcurve.hpp 2011-06-29 17:50:59 UTC (rev 17822)
> +++ trunk/QuantLib/ql/termstructures/inflation/
> piecewisezeroinflationcurve.hpp 2011-06-29 18:01:02 UTC (rev 17823)
> @@ -3,6 +3,7 @@
> /*
>  Copyright (C) 2007 Chris Kenyon
>  Copyright (C) 2007, 2008 StatPro Italia srl
> + Copyright (C) 2011 Ferdinando Ametrano
>
>  This file is part of QuantLib, a free-software/open-source library
>  for financial quantitative analysts and developers - http://quantlib.org/
> @@ -49,18 +50,36 @@
>         static Rate initialValue(const ZeroInflationTermStructure*  
> t) {
>             return t->baseRate();
>         }
> -        static Rate initialGuess() { return 0.02; }
> -        // further guesses
> -        static Rate guess(const ZeroInflationTermStructure*, const  
> Date&) {
> +
> +        // guesses
> +        template <class C>
> +        static Rate guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return 0.02;
> +
> +            // could/should extrapolate
>             return 0.02;    // initial guess at flat inflation
>         }
> +
>         // possible constraints based on previous values
> -        static Real minValueAfter(Size, const std::vector<Rate>&) {
> +        template <class C>
> +        static Real minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return -0.1 + QL_EPSILON;
>         }
> -        static Real maxValueAfter(Size, const std::vector<Rate>&) {
> +        template <class C>
> +        static Real maxValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             return 0.3 - QL_EPSILON;
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Rate>& data,
>                                 Rate level,
> @@ -195,4 +214,3 @@
> }
>
> #endif
> -
>
> Modified: trunk/QuantLib/ql/termstructures/iterativebootstrap.hpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/iterativebootstrap.hpp
> 2011-06-29 17:50:59 UTC (rev 17822)
> +++ trunk/QuantLib/ql/termstructures/iterativebootstrap.hpp
> 2011-06-29 18:01:02 UTC (rev 17823)
> @@ -114,7 +114,7 @@
>             ts_->data_[0] = Traits::initialValue(ts_);
>             // reasonable numbers needed for the starting  
> interpolation
>             for (Size i=1; i<alive_+1; ++i)
> -                ts_->data_[i] = Traits::initialGuess();
> +                ts_->data_[i] = Traits::guess(1, ts_, false);
>         }
>         initialized_ = true;
>     }
> @@ -149,21 +149,18 @@
>
>                 bool validData = validCurve_ || iteration>0;
>
> -                // bracket root
> -                Real min = Traits::minValueAfter(i, ts_->data_);
> -                Real max = Traits::maxValueAfter(i, ts_->data_);
> +                // bracket root and calculate guess
> +                Real min = Traits::minValueAfter(i, ts_, validData);
> +                Real max = Traits::maxValueAfter(i, ts_, validData);
> +                Real guess = Traits::guess(i, ts_, validData);
> +                // adjust guess if needed
> +                if (guess>=max)
> +                    guess = max - (max-min)/5.0;
> +                else if (guess<=min)
> +                    guess = min + (max-min)/5.0;
>
> -                // calculate guess and extend interpolation if needed
> -                Real guess = 0.0;
> -                if (validData) {
> -                    guess = ts_->data_[i]; // previous iteration  
> value
> -                } else {
> -                    if (i==1) // special first pillar case
> -                        guess = Traits::initialGuess();
> -                    else // most traits extrapolate (using only
> -                         // the curve bootstrapped so far)
> -                        guess = Traits::guess(ts_, ts_->dates_[i]);
> -
> +                // extend interpolation if needed
> +                if (!validData) {
>                     try { // extend interpolation a point at a time
>                           // including the pillar to be boostrapped
>                         ts_->interpolation_ = ts_-
> >interpolator_.interpolate(
> @@ -182,11 +179,6 @@
>                         ts_->interpolation_.update();
>                     }
>                 }
> -                // adjust guess if needed
> -                if (guess>=max)
> -                    guess = max - (max-min)/5.0;
> -                else if (guess<=min)
> -                    guess = min + (max-min)/5.0;
>
>                 // the actual instrument used for the current pillar
>                 boost::shared_ptr<typename Traits::helper>  
> instrument =
>
> Modified: trunk/QuantLib/ql/termstructures/localbootstrap.hpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/localbootstrap.hpp 2011-06-29  
> 17:50:59 UTC (rev 17822)
> +++ trunk/QuantLib/ql/termstructures/localbootstrap.hpp 2011-06-29  
> 18:01:02 UTC (rev 17823)
> @@ -222,7 +222,7 @@
>
>             if (iInst >= localisation_) {
>                 startArray[localisation_-dataAdjust] =
> -                    Traits::guess(ts_, ts_->dates_[iInst]);
> +                    Traits::guess(iInst, ts_, false); // ?
>             } else {
>                 startArray[localisation_-dataAdjust] = ts_->data_[0];
>             }
>
> Modified: trunk/QuantLib/ql/termstructures/yield/bootstraptraits.hpp
> ===================================================================
> --- trunk/QuantLib/ql/termstructures/yield/bootstraptraits.hpp
> 2011-06-29 17:50:59 UTC (rev 17822)
> +++ trunk/QuantLib/ql/termstructures/yield/bootstraptraits.hpp
> 2011-06-29 18:01:02 UTC (rev 17823)
> @@ -2,6 +2,7 @@
>
> /*
>  Copyright (C) 2005, 2007 StatPro Italia srl
> + Copyright (C) 2011 Ferdinando Ametrano
>  Copyright (C) 2007 Chris Kenyon
>
>  This file is part of QuantLib, a free-software/open-source library
> @@ -46,6 +47,7 @@
>         };
>         // helper class
>         typedef BootstrapHelper<YieldTermStructure> helper;
> +
>         // start of curve data
>         static Date initialDate(const YieldTermStructure* c) {
>             return c->referenceDate();
> @@ -54,31 +56,44 @@
>         static DiscountFactor initialValue(const  
> YieldTermStructure*) {
>             return 1.0;
>         }
> -        // initial guess
> -        static DiscountFactor initialGuess() {
> -            return 1.0/(1.0+detail::avgRate*0.25);
> -        }
> -        // further guesses
> -        static DiscountFactor guess(const YieldTermStructure* c,
> -                                    const Date& d) {
> +
> +        // guesses
> +        template <class C>
> +        static DiscountFactor guess(Size i,
> +                                    const C* c,
> +                                    bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return 1.0/(1.0+detail::avgRate*0.25);
> +
> +            // extrapolate
> +            Date d = c->dates()[i];
>             return c->discount(d,true);
>         }
> +
>         // possible constraints based on previous values
> -        static DiscountFactor minValueAfter(Size,
> -                                            const  
> std::vector<Real>&) {
> +        template <class C>
> +        static DiscountFactor minValueAfter(Size i,
> +                                            const C* c,
> +                                            bool validData) {
>             return QL_EPSILON;
>         }
> +        template <class C>
>         static DiscountFactor maxValueAfter(Size i,
> -                                            const  
> std::vector<Real>& data) {
> +                                            const C* c,
> +                                            bool validData) {
>             #if defined(QL_NEGATIVE_RATES)
>             // discount are not required to be decreasing--all bets  
> are off.
>             // We choose as max a value very unlikely to be exceeded.
>             return 1.1;
>             #else
>             // discounts cannot increase
> -            return data[i-1];
> +            return c->data()[i-1];
>             #endif
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<DiscountFactor>& data,
>                                 DiscountFactor discount,
> @@ -107,16 +122,29 @@
>         static Rate initialValue(const YieldTermStructure*) {
>             return detail::avgRate;
>         }
> -        // initial guess
> -        static Rate initialGuess() { return detail::avgRate; }
> -        // further guesses
> -        static Rate guess(const YieldTermStructure* c,
> -                          const Date& d) {
> +
> +        // guesses
> +        template <class C>
> +        static Rate guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return detail::avgRate;
> +
> +            // extrapolate
> +            Date d = c->dates()[i];
>             return c->zeroRate(d, c->dayCounter(),
>                                Continuous, Annual, true);
>         }
> +
>         // possible constraints based on previous values
> -        static Rate minValueAfter(Size, const std::vector<Real>&) {
> +        template <class C>
> +        static Rate minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             #if defined(QL_NEGATIVE_RATES)
>             // no constraints.
>             // We choose as min a value very unlikely to be exceeded.
> @@ -125,11 +153,15 @@
>             return QL_EPSILON;
>             #endif
>         }
> -        static Rate maxValueAfter(Size, const std::vector<Real>&) {
> +        template <class C>
> +        static Rate maxValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             // no constraints.
>             // We choose as max a value very unlikely to be exceeded.
>             return detail::maxRate;
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Rate>& data,
>                                 Rate rate,
> @@ -160,16 +192,29 @@
>         static Rate initialValue(const YieldTermStructure*) {
>             return detail::avgRate;
>         }
> -        // initial guess
> -        static Rate initialGuess() { return detail::avgRate; }
> -        // further guesses
> -        static Rate guess(const YieldTermStructure* c,
> -                          const Date& d) {
> +
> +        // guesses
> +        template <class C>
> +        static Rate guess(Size i,
> +                          const C* c,
> +                          bool validData) {
> +            if (validData) // previous iteration value
> +                return c->data()[i];
> +
> +            if (i==1) // first pillar
> +                return detail::avgRate;
> +
> +            // extrapolate
> +            Date d = c->dates()[i];
>             return c->forwardRate(d, d, c->dayCounter(),
>                                   Continuous, Annual, true);
>         }
> +
>         // possible constraints based on previous values
> -        static Rate minValueAfter(Size, const std::vector<Real>&) {
> +        template <class C>
> +        static Rate minValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             #if defined(QL_NEGATIVE_RATES)
>             // no constraints.
>             // We choose as min a value very unlikely to be exceeded.
> @@ -178,11 +223,15 @@
>             return QL_EPSILON;
>             #endif
>         }
> -        static Rate maxValueAfter(Size, const std::vector<Real>&) {
> +        template <class C>
> +        static Rate maxValueAfter(Size i,
> +                                  const C* c,
> +                                  bool validData) {
>             // no constraints.
>             // We choose as max a value very unlikely to be exceeded.
>             return detail::maxRate;
>         }
> +
>         // update with new guess
>         static void updateGuess(std::vector<Rate>& data,
>                                 Rate forward,
>
>
> This was sent by the SourceForge.net collaborative development  
> platform, the world's largest Open Source development site.
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously  
> valuable.
> Why? It contains a definitive record of application performance,  
> security
> threats, fraudulent activity, and more. Splunk takes this data and  
> makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> QuantLib-cvs mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-cvs


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib:[17823] trunk/QuantLib/ql

Ferdinando M. Ametrano-3
> Sorry, it breaks backwards compatibility.  We'll have to think how to go
> about this, and it's ok to leave it for the time being, but it will have to
> be reverted.

mmm... I saw this coming, but wanted to give you a chance at being
less conservative :-)

jokes aside, let me add few points to think about:

1) I broke the backward compatibility of yield/credit/inflation
traits, but is there anyone using those traits decoupled from QuantLib
iterative bootstrap? Really hard to believe.. and if such a geek
exists, please speak up now!
Anyway I could add the old signature (deprecated) methods back along
with the new overloads: this would preserve backward compatibility,
but I see little point besides obfuscating the traits usage

2) my refactored iterative bootstrap does use the new traits methods,
and so I broke any proprietary traits used for bootstrapping
proprietary curves with QuantLib iterative bootstrap. Frankly I find
hard to believe that someone able to figure out how to write new
traits would have problems moving them to their new generalized
interface. It's much more likely that such a coder would consider the
huge speedup of the bootstrap worth the few minutes needed for adding
a curve pointer in the signature

As for the benefit of this refactoring:

a) the guess change is to separate guessing from iterative
boostrapping. To fully delegate guessing to the traits improves
dramatically the readability of the iterative bootstrap. In the
previous version of iterative bootstrap the guess logic intervened
badly with the bootstrap logic.
Anyway this is mostly a cosmetic change: to revert it would just
increase the universe entropy and no more

b) the minValueAfter, maxValueAfter change is the relevant one: to
give those methods access to the full curve allows for much better
bracketing of the solution. This is crucial (even when the curve
previous state is an excellent guess) because the ineffective
bracketing is currently the major issue slowing down the bootstrap.

One final note: if we were to agree on this interface change I would
go further and add the ratehelpers in the new signatures: they might
be used to improve guess and bracketing, even if I don't plan to use
them anytime soon

What do you think about it, Luigi?
Anyone else willing to contribute his feedback?

ciao -- Nando

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: [QuantLib-svn] SF.net SVN: quantlib:[17823] trunk/QuantLib/ql

Luigi Ballabio
On Thu, 2011-06-30 at 11:11 +0200, Ferdinando Ametrano wrote:
> > Sorry, it breaks backwards compatibility.  We'll have to think how to go
> > about this, and it's ok to leave it for the time being, but it will have to
> > be reverted.
>
> mmm... I saw this coming, but wanted to give you a chance at being
> less conservative :-)

Ok.  Since there's little chance of anybody having written any code that
might break, go ahead; but please write a short how-to in the News.txt
file explaining how to change one's own traits and bootstrap.

Ciao,
        Luigi


> jokes aside, let me add few points to think about:
>
> 1) I broke the backward compatibility of yield/credit/inflation
> traits, but is there anyone using those traits decoupled from QuantLib
> iterative bootstrap? Really hard to believe.. and if such a geek
> exists, please speak up now!
> Anyway I could add the old signature (deprecated) methods back along
> with the new overloads: this would preserve backward compatibility,
> but I see little point besides obfuscating the traits usage
>
> 2) my refactored iterative bootstrap does use the new traits methods,
> and so I broke any proprietary traits used for bootstrapping
> proprietary curves with QuantLib iterative bootstrap. Frankly I find
> hard to believe that someone able to figure out how to write new
> traits would have problems moving them to their new generalized
> interface. It's much more likely that such a coder would consider the
> huge speedup of the bootstrap worth the few minutes needed for adding
> a curve pointer in the signature
>
> As for the benefit of this refactoring:
>
> a) the guess change is to separate guessing from iterative
> boostrapping. To fully delegate guessing to the traits improves
> dramatically the readability of the iterative bootstrap. In the
> previous version of iterative bootstrap the guess logic intervened
> badly with the bootstrap logic.
> Anyway this is mostly a cosmetic change: to revert it would just
> increase the universe entropy and no more
>
> b) the minValueAfter, maxValueAfter change is the relevant one: to
> give those methods access to the full curve allows for much better
> bracketing of the solution. This is crucial (even when the curve
> previous state is an excellent guess) because the ineffective
> bracketing is currently the major issue slowing down the bootstrap.
>
> One final note: if we were to agree on this interface change I would
> go further and add the ratehelpers in the new signatures: they might
> be used to improve guess and bracketing, even if I don't plan to use
> them anytime soon
>
> What do you think about it, Luigi?
> Anyone else willing to contribute his feedback?
>
> ciao -- Nando

--

Can't act. Slightly bald. Also dances.
-- RKO executive, reacting to Fred Astaire's screen test.
Cerf/Navasky, "The Experts Speak"



------------------------------------------------------------------------------
AppSumo Presents a FREE Video for the SourceForge Community by Eric
Ries, the creator of the Lean Startup Methodology on "Lean Startup
Secrets Revealed." This video shows you how to validate your ideas,
optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev