Hello to everybody,
I would like to throw kind of a general question. I am bootstrapping my discounting and forwarding curves in order to price something (let's say a swaps as in QuantLib example). If I have instanciated a PiecewiseYieldCurve class and have it stored either as a pointer (boost::shared_ptr<QuantLib::YieldTermStructure> ( new QuantLib::PiecewiseYieldCurve<QuantLib::Discount,QuantLib::Cubic>( etc... )) or as the class itself, can I safely copy it in the case I want to change a pillar and compare the old with the new result? I guess that if I use the operator= or the copy constructor I should perform a shallow copy only. Am I wrong? Does anyone has ever though of how to perform a complete deep copy of it? More troublesome. If I bootstrap within a multi-curve framework I can give the RateHelper the discounting curve as an input parameter of its constructor. Ok, but this is a Handle, which means that if I copy the RateHelper I am copy the Handle and not the resource the Handle is pointing to. Right? Thanks in advance for sharing your knowledge. Best. Stefano |
Hello Stefano, you're correct on both counts. The copy constructor of PiecewiseYieldCurve will just perform a shallow copy. If you want to perform comparisons, you're better off building two identical curves. And if you copy a RateHelper, you're just copying the Handle, so the copy will still point to the same discounting curve. That's part of the point of using the Handle: if the curve changes, all the helpers can see the change. Luigi On Thu, Nov 13, 2014 at 12:10 PM, Stefano Portolan <[hidden email]> wrote: Hello to everybody, ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |