Lazy Calibration Helper

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Lazy Calibration Helper

Peter Caspers-4
Hi Luigi,

if I understand it correctly a CalibrationHelper observes its market
data and triggers the market price calculation every time this data
changes directly via the update() method. Doesn't that mean that the
yield term structure feeded into a calibrationhelper will effectively
loose its lazy behaviour? At least I have code that makes problems and I
think the reason is exactly this. My solution would be as follows:

Make the CalibrationHelper lazy by virtual inheritance to Observer and
LazyObject by defining:

class CalibrationHelper : public virtual Observer, public Observable,
public virtual LazyObject {

...

void performCalculations() const {
    marketValue_ = blackPrice(volatility_->value());
}

void update() {
    LazyObject::update();
}

//! returns the actual price of the instrument (from volatility)
Real marketValue() const { calculate(); return marketValue_; }

...

This solves my problem. The testsuite seems to run with that change
without problems.

What do you think ? Good idea or bad idea ?

Thanks a lot and kind regards
Peter

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev