Dear
all,
has anybody an idea
how to set a Relinkable Handle who is already linked to a YieldTermStructure
object back to Null, so that the function
"empty()" returns
again true?
Best and
thanks
Chris
------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi, Luigi On Oct 18, 2013 4:01 PM, "Breig, Dr. Christoph (IDS GmbH)" <[hidden email]> wrote:
------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Luigi, hi all
the empty shared_ptr works fine for e.g.
InterpolatedZeroCurves but not for ZeroSpreadedTermStructures. Then, while
setting the empty shared_ptr, following error messages
takes place:
"could not notify one or more observers: empty Handle
cannot be dereferenced"
I'm at the moment using version 1.0 of QuantLib (in case
the problem is a bug and was already fixed).
Best and thanks
Chris Von: Luigi Ballabio [mailto:[hidden email]] Gesendet: Freitag, 18. Oktober 2013 16:13 An: Breig, Dr. Christoph (IDS GmbH) Cc: QuantLib developers Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to Null Hi, Luigi On Oct 18, 2013 4:01 PM, "Breig, Dr. Christoph (IDS
GmbH)" <[hidden email]>
wrote:
------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
It looks like the spreaded curve notifies its observers of the change,
one of them tries to perform some calculation as a consequence, and the calculation fails because the handle is empty. Can you reproduce the problem in a short program you can post? Luigi On Wed, Oct 23, 2013 at 4:49 PM, Breig, Dr. Christoph (IDS GmbH) <[hidden email]> wrote: > Hi Luigi, hi all > > the empty shared_ptr works fine for e.g. InterpolatedZeroCurves but not for > ZeroSpreadedTermStructures. Then, while setting the empty shared_ptr, > following error messages takes place: > "could not notify one or more observers: empty Handle cannot be > dereferenced" > > I'm at the moment using version 1.0 of QuantLib (in case the problem is a > bug and was already fixed). > > Best and thanks > Chris > > ________________________________ > Von: Luigi Ballabio [mailto:[hidden email]] > Gesendet: Freitag, 18. Oktober 2013 16:13 > An: Breig, Dr. Christoph (IDS GmbH) > Cc: QuantLib developers > Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to > Null > > Hi, > link it to an empty shared_ptr. > > Luigi > > On Oct 18, 2013 4:01 PM, "Breig, Dr. Christoph (IDS GmbH)" > <[hidden email]> wrote: >> >> Dear all, >> >> has anybody an idea how to set a Relinkable Handle who is already linked >> to a YieldTermStructure object back to Null, so that the function >> "empty()" returns again true? >> >> Best and thanks >> Chris >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register > >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk >> _______________________________________________ >> QuantLib-dev mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/quantlib-dev >> > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Hi Luigi, hi all,
yes, here is it. Do you have an idea how to reset "discTermStructure" after the initialisation of "spreadedDiscTermStructure". ------------------- #include <ql/quantlib.hpp> using namespace QuantLib; int main(int, char* []) { try { QuantLib::RelinkableHandle<QuantLib::YieldTermStructure> discTermStructure; boost::shared_ptr<YieldTermStructure> nullYTSPtr; Date evaluationDate = Date(23,Month(10),2013); boost::shared_ptr<YieldTermStructure> yts(new FlatForward(evaluationDate, 0.02, ActualActual())); discTermStructure.linkTo(yts); boost::shared_ptr<Quote> spread(new SimpleQuote(0.02)); // no problem discTermStructure.linkTo(nullYTSPtr); discTermStructure.linkTo(yts); // problem boost::shared_ptr<YieldTermStructure> spreadedDiscTermStructure(new ZeroSpreadedTermStructure(discTermStructure,Handle<Quote>(spread))); discTermStructure.linkTo(nullYTSPtr); system("PAUSE"); return 0; } catch (std::exception& e) { std::cerr << e.what() << std::endl; system("PAUSE"); return 1; } catch (...) { std::cerr << "unknown error" << std::endl; system("PAUSE"); return 1; } } ------------- Best and thx Chris -----Ursprüngliche Nachricht----- Von: Luigi Ballabio [mailto:[hidden email]] Gesendet: Mittwoch, 23. Oktober 2013 18:08 An: Breig, Dr. Christoph (IDS GmbH) Cc: QuantLib developers Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to Null It looks like the spreaded curve notifies its observers of the change, one of them tries to perform some calculation as a consequence, and the calculation fails because the handle is empty. Can you reproduce the problem in a short program you can post? Luigi On Wed, Oct 23, 2013 at 4:49 PM, Breig, Dr. Christoph (IDS GmbH) <[hidden email]> wrote: > Hi Luigi, hi all > > the empty shared_ptr works fine for e.g. InterpolatedZeroCurves but not for > ZeroSpreadedTermStructures. Then, while setting the empty shared_ptr, > following error messages takes place: > "could not notify one or more observers: empty Handle cannot be > dereferenced" > > I'm at the moment using version 1.0 of QuantLib (in case the problem is a > bug and was already fixed). > > Best and thanks > Chris > > ________________________________ > Von: Luigi Ballabio [mailto:[hidden email]] > Gesendet: Freitag, 18. Oktober 2013 16:13 > An: Breig, Dr. Christoph (IDS GmbH) > Cc: QuantLib developers > Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to > Null > > Hi, > link it to an empty shared_ptr. > > Luigi > > On Oct 18, 2013 4:01 PM, "Breig, Dr. Christoph (IDS GmbH)" > <[hidden email]> wrote: >> >> Dear all, >> >> has anybody an idea how to set a Relinkable Handle who is already linked >> to a YieldTermStructure object back to Null, so that the function >> "empty()" returns again true? >> >> Best and thanks >> Chris >> >> >> ------------------------------------------------------------------------------ >> October Webinars: Code for Performance >> Free Intel webinars can help you accelerate application performance. >> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >> from >> the latest Intel processors and coprocessors. See abstracts and register > >> >> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk >> _______________________________________________ >> QuantLib-dev mailing list >> [hidden email] >> https://lists.sourceforge.net/lists/listinfo/quantlib-dev >> > -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Ok, I see. It's YieldTermStructure::update(), which gets called when
the zero-spreaded curve is notified that the discount handle has changed and tries to calculate the new reference date. Except it can't, because the handle is empty. As a quick and dirty fix, wrap the "if" in YieldTermStructure::update() in a try/catch and just block the exception. But be aware that this could hide other problems, i.e., actual exceptions in setJumps(). I'll try and commit a more robust patch in the repository. Luigi On Wed, Oct 23, 2013 at 11:13 PM, Breig, Dr. Christoph (IDS GmbH) <[hidden email]> wrote: > Hi Luigi, hi all, > yes, here is it. Do you have an idea how to reset "discTermStructure" after the initialisation of "spreadedDiscTermStructure". > ------------------- > #include <ql/quantlib.hpp> > > using namespace QuantLib; > > int main(int, char* []) { > > try { > > QuantLib::RelinkableHandle<QuantLib::YieldTermStructure> discTermStructure; > boost::shared_ptr<YieldTermStructure> nullYTSPtr; > Date evaluationDate = Date(23,Month(10),2013); > boost::shared_ptr<YieldTermStructure> yts(new FlatForward(evaluationDate, 0.02, ActualActual())); > discTermStructure.linkTo(yts); > boost::shared_ptr<Quote> spread(new SimpleQuote(0.02)); > > // no problem > discTermStructure.linkTo(nullYTSPtr); > discTermStructure.linkTo(yts); > > // problem > boost::shared_ptr<YieldTermStructure> spreadedDiscTermStructure(new ZeroSpreadedTermStructure(discTermStructure,Handle<Quote>(spread))); > discTermStructure.linkTo(nullYTSPtr); > > system("PAUSE"); > return 0; > > } catch (std::exception& e) { > std::cerr << e.what() << std::endl; > system("PAUSE"); > return 1; > } catch (...) { > std::cerr << "unknown error" << std::endl; > system("PAUSE"); > return 1; > } > } > > ------------- > > Best and thx > Chris > > -----Ursprüngliche Nachricht----- > Von: Luigi Ballabio [mailto:[hidden email]] > Gesendet: Mittwoch, 23. Oktober 2013 18:08 > An: Breig, Dr. Christoph (IDS GmbH) > Cc: QuantLib developers > Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to Null > > It looks like the spreaded curve notifies its observers of the change, > one of them tries to perform some calculation as a consequence, and > the calculation fails because the handle is empty. Can you reproduce > the problem in a short program you can post? > > Luigi > > > On Wed, Oct 23, 2013 at 4:49 PM, Breig, Dr. Christoph (IDS GmbH) > <[hidden email]> wrote: >> Hi Luigi, hi all >> >> the empty shared_ptr works fine for e.g. InterpolatedZeroCurves but not for >> ZeroSpreadedTermStructures. Then, while setting the empty shared_ptr, >> following error messages takes place: >> "could not notify one or more observers: empty Handle cannot be >> dereferenced" >> >> I'm at the moment using version 1.0 of QuantLib (in case the problem is a >> bug and was already fixed). >> >> Best and thanks >> Chris >> >> ________________________________ >> Von: Luigi Ballabio [mailto:[hidden email]] >> Gesendet: Freitag, 18. Oktober 2013 16:13 >> An: Breig, Dr. Christoph (IDS GmbH) >> Cc: QuantLib developers >> Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to >> Null >> >> Hi, >> link it to an empty shared_ptr. >> >> Luigi >> >> On Oct 18, 2013 4:01 PM, "Breig, Dr. Christoph (IDS GmbH)" >> <[hidden email]> wrote: >>> >>> Dear all, >>> >>> has anybody an idea how to set a Relinkable Handle who is already linked >>> to a YieldTermStructure object back to Null, so that the function >>> "empty()" returns again true? >>> >>> Best and thanks >>> Chris >>> >>> >>> ------------------------------------------------------------------------------ >>> October Webinars: Code for Performance >>> Free Intel webinars can help you accelerate application performance. >>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >>> from >>> the latest Intel processors and coprocessors. See abstracts and register > >>> >>> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk >>> _______________________________________________ >>> QuantLib-dev mailing list >>> [hidden email] >>> https://lists.sourceforge.net/lists/listinfo/quantlib-dev >>> >> > > > > -- > <https://implementingquantlib.blogspot.com> > <https://twitter.com/lballabio> -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ October Webinars: Code for Performance Free Intel webinars can help you accelerate application performance. Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from the latest Intel processors and coprocessors. See abstracts and register > http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
It should be fixed now in the git repository.
Luigi On Thu, Oct 24, 2013 at 11:20 AM, Luigi Ballabio <[hidden email]> wrote: > Ok, I see. It's YieldTermStructure::update(), which gets called when > the zero-spreaded curve is notified that the discount handle has > changed and tries to calculate the new reference date. Except it > can't, because the handle is empty. > > As a quick and dirty fix, wrap the "if" in > YieldTermStructure::update() in a try/catch and just block the > exception. But be aware that this could hide other problems, i.e., > actual exceptions in setJumps(). I'll try and commit a more robust > patch in the repository. > > Luigi > > > On Wed, Oct 23, 2013 at 11:13 PM, Breig, Dr. Christoph (IDS GmbH) > <[hidden email]> wrote: >> Hi Luigi, hi all, >> yes, here is it. Do you have an idea how to reset "discTermStructure" after the initialisation of "spreadedDiscTermStructure". >> ------------------- >> #include <ql/quantlib.hpp> >> >> using namespace QuantLib; >> >> int main(int, char* []) { >> >> try { >> >> QuantLib::RelinkableHandle<QuantLib::YieldTermStructure> discTermStructure; >> boost::shared_ptr<YieldTermStructure> nullYTSPtr; >> Date evaluationDate = Date(23,Month(10),2013); >> boost::shared_ptr<YieldTermStructure> yts(new FlatForward(evaluationDate, 0.02, ActualActual())); >> discTermStructure.linkTo(yts); >> boost::shared_ptr<Quote> spread(new SimpleQuote(0.02)); >> >> // no problem >> discTermStructure.linkTo(nullYTSPtr); >> discTermStructure.linkTo(yts); >> >> // problem >> boost::shared_ptr<YieldTermStructure> spreadedDiscTermStructure(new ZeroSpreadedTermStructure(discTermStructure,Handle<Quote>(spread))); >> discTermStructure.linkTo(nullYTSPtr); >> >> system("PAUSE"); >> return 0; >> >> } catch (std::exception& e) { >> std::cerr << e.what() << std::endl; >> system("PAUSE"); >> return 1; >> } catch (...) { >> std::cerr << "unknown error" << std::endl; >> system("PAUSE"); >> return 1; >> } >> } >> >> ------------- >> >> Best and thx >> Chris >> >> -----Ursprüngliche Nachricht----- >> Von: Luigi Ballabio [mailto:[hidden email]] >> Gesendet: Mittwoch, 23. Oktober 2013 18:08 >> An: Breig, Dr. Christoph (IDS GmbH) >> Cc: QuantLib developers >> Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to Null >> >> It looks like the spreaded curve notifies its observers of the change, >> one of them tries to perform some calculation as a consequence, and >> the calculation fails because the handle is empty. Can you reproduce >> the problem in a short program you can post? >> >> Luigi >> >> >> On Wed, Oct 23, 2013 at 4:49 PM, Breig, Dr. Christoph (IDS GmbH) >> <[hidden email]> wrote: >>> Hi Luigi, hi all >>> >>> the empty shared_ptr works fine for e.g. InterpolatedZeroCurves but not for >>> ZeroSpreadedTermStructures. Then, while setting the empty shared_ptr, >>> following error messages takes place: >>> "could not notify one or more observers: empty Handle cannot be >>> dereferenced" >>> >>> I'm at the moment using version 1.0 of QuantLib (in case the problem is a >>> bug and was already fixed). >>> >>> Best and thanks >>> Chris >>> >>> ________________________________ >>> Von: Luigi Ballabio [mailto:[hidden email]] >>> Gesendet: Freitag, 18. Oktober 2013 16:13 >>> An: Breig, Dr. Christoph (IDS GmbH) >>> Cc: QuantLib developers >>> Betreff: Re: [Quantlib-dev] RelinkableHandle<YieldTermStructure> reset to >>> Null >>> >>> Hi, >>> link it to an empty shared_ptr. >>> >>> Luigi >>> >>> On Oct 18, 2013 4:01 PM, "Breig, Dr. Christoph (IDS GmbH)" >>> <[hidden email]> wrote: >>>> >>>> Dear all, >>>> >>>> has anybody an idea how to set a Relinkable Handle who is already linked >>>> to a YieldTermStructure object back to Null, so that the function >>>> "empty()" returns again true? >>>> >>>> Best and thanks >>>> Chris >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> October Webinars: Code for Performance >>>> Free Intel webinars can help you accelerate application performance. >>>> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most >>>> from >>>> the latest Intel processors and coprocessors. See abstracts and register > >>>> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk >>>> _______________________________________________ >>>> QuantLib-dev mailing list >>>> [hidden email] >>>> https://lists.sourceforge.net/lists/listinfo/quantlib-dev >>>> >>> >> >> >> >> -- >> <https://implementingquantlib.blogspot.com> >> <https://twitter.com/lballabio> > > > > -- > <https://implementingquantlib.blogspot.com> > <https://twitter.com/lballabio> -- <https://implementingquantlib.blogspot.com> <https://twitter.com/lballabio> ------------------------------------------------------------------------------ Android is increasing in popularity, but the open development platform that developers love is also attractive to malware creators. Download this white paper to learn more about secure code signing practices that can help keep Android apps secure. http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |