Login  Register

Questions about LazyObject::recalculate

Posted by Mike Jake on May 30, 2012; 8:58pm
URL: http://quantlib.414.s1.nabble.com/Questions-about-LazyObject-recalculate-tp7823.html

        */
        //@{
        /*! 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