*/
//@{ /*! This method force the recalculation of any results which would otherwise be cached. It is not declared as <tt>const</tt> since it needs to call the non-<tt>const</tt> <i><b>notifyObservers</b></i> method. \note Explicit invocation of this method is <b>not</b> necessary if the object registered itself as observer with the structures on which such results depend. It is strongly advised to follow this policy when possible. */ void LazyObject::recalculate(); Based on the above doc, we should not call this function directly if the object is registered. However, I still cannot figure out how the registered object can call this function finally. Based on the distribution code, I found many cases, where the function is called explicitly. Find all "recalculate()", Match case, Subfolders, C:\QuantLib\QuantLib-1.2\ql\experimental\credit\riskyassetswap.cpp(215): asw_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\experimental\inflation\interpolatedyoyoptionletstripper.hpp(284): testPW->recalculate(); C:\QuantLib\QuantLib-1.2\ql\experimental\inflation\yoycapfloortermpricesurface.hpp(540): pYITS->recalculate(); C:\QuantLib\QuantLib-1.2\ql\experimental\inflation\yoyoptionlethelpers.cpp(74): yoyCapFloor_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\instruments\compositeinstrument.hpp(44): recalculate(), freeze() and others) might not work C:\QuantLib\QuantLib-1.2\ql\patterns\lazyobject.hpp(60): void recalculate(); C:\QuantLib\QuantLib-1.2\ql\patterns\lazyobject.hpp(118): inline void LazyObject::recalculate() { C:\QuantLib\QuantLib-1.2\ql\quotes\forwardswapquote.cpp(80): swap_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\quotes\forwardswapquote.cpp(90): swap_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\termstructures\credit\defaultprobabilityhelpers.cpp(154): swap_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\termstructures\credit\defaultprobabilityhelpers.cpp(231): swap_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\termstructures\inflation\inflationhelpers.cpp(82): zciis_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\termstructures\inflation\inflationhelpers.cpp(168): yyiis_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\termstructures\yield\bondhelpers.cpp(59): bond_->recalculate(); C:\QuantLib\QuantLib-1.2\ql\termstructures\yield\oisratehelper.cpp(74): swap_->recalculate(); Question> Is the doc correct? ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
On Wed, May 30, 2012 at 10:58 PM, Mike Jake <[hidden email]> wrote:
> */ > //@{ > /*! This method force the recalculation of any results which > would otherwise be cached. It is not declared as > <tt>const</tt> since it needs to call the > non-<tt>const</tt> <i><b>notifyObservers</b></i> method. > > \note Explicit invocation of this method is <b>not</b> > necessary if the object registered itself as > observer with the structures on which such results > depend. It is strongly advised to follow this > policy when possible. > */ > void LazyObject::recalculate(); > > Based on the above doc, we should not call this function directly if the > object is registered. > However, I still cannot figure out how the registered object can call this > function finally. It's not that you should not call it, it's more like "this method is here in case you need to manage recalculation manually, but it's tricky to get it right so instead we suggest you just register, sit back and relax". The library does use it in a few places, but it's mostly in cases in which there's some reason not to register (for instance during a curve bootstrap, in which registration as usual will result in a cycle). In the usual scenario, the registered object doesn't call this and goes through calculate() instead. Luigi ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ QuantLib-users mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-users |
Free forum by Nabble | Edit this page |