|
From: Joseph W. <jo...@gn...> - 2006-11-28 20:08:11
|
The three abstract interfaces that I'd like to define are
class Surface : public std::binary_function<Real, Real, Real> {
public:
virtual Real operator()(Real x, Real y) const =3D 0;
virtual Domain* domain() const =3D 0;
virtual ~Surface() {};
};
class Domain : public std::binary_function<Real, Real, bool>{
public:
virtual bool includes(Real x, Real y) const =3D 0;
bool operator()(Real x, Real y) {return includes(x, y);}
virtual ~Domain() {};
};
class Curve : public std::unary_function<Real, Real> {
public:
virtual Real operator()(Real x) const =3D 0;
};
The rationale behind defining these classes is more computational than=20
finance. Basically if these three classes exist, then when I write a=20
external plotting function, I need only have the function understand=20
surfaces, domains, and curves, and it doesn't need to know about any of the=
=20
details behind the class.
Also you can do things like:
class RFunction : public Curve {
public:
RFunction(SEXP *);
}
class PythonFunction : public Curve {
public:
PythonFunction(Handler *);
}
One subclass in particular is
class TimeIndexedSurface : public Surface, public TimeSeries <Curve> {
public:
TimeIndexedSurface (Date referenceDate &);
void addCurve(Date, const Curve &);
}
What this would do in combination with the PDE code is that as the PDE is=20
calculating, it can add results to this class, and from QuantLib's point of=
=20
view it is seeing a TimeSeries of curves. An external plotting application=
=20
sees that this class is also of type Surface and can run through that=20
interface to plot the surface generated by a finite difference run.
The other use for this is that I have data from Shanghai warrants and I wan=
t=20
to see if the volatility smile evolves. So I want to slice up the data int=
o=20
time bins, do a regression on each bin, and then plot the surface. For thi=
s=20
I need an object that could store the regressions. Most scripting language=
s=20
don't have data structures that are flexible enough (or are too flexible) t=
o=20
do this.
=E5=9C=A8 Tuesday 28 November 2006 02:52=EF=BC=8C=E6=82=A8=E5=86=99=E9=81=
=93=EF=BC=9A
> Hi Joseph
>
> it would be nice if you could give us a more detailed idea about how
> this class would be used, especially from the financial point of view.
>
> we're in the middle of some major refactoring of interest rate
> volatility surfaces, and I would prefer to have a clear idea about
> overlapping, if any.
>
> ciao -- Nando
>
> On 11/28/06, Joseph Wang <jo...@gn...> wrote:
> > Unless someone objects, I'd like to check in a set of classes that
> > provide a standardized interface to surfaces in quantlib. The basic
> > interface is a Surface class that returns a real in return to two real
> > inputs and provides information about the domain the Surface is valid.=
=20
> > The idea behind this is to provide a standard interface for external
> > plotting packages.
> >
> > The goal in three or four months time is to make this work with Python
> > and VTK to provide the sort of visualization which is standard in CFD,
> > medical and petroleum, but which I haven't seen yet in QF.
> >
> > The other thing that we probably should look at before 1.0 is to look at
> > the classes and see if there are any that are redundant.
> >
> >
> > --
> > -----------------------------------------------------------------------=
=2D-
> >------ Joseph Wang Ph.D. - jo...@gn...
> > China Derivatives Researcher and Software Developer - QuantLib
> > http://en.wikiversity.org/wiki/User:Roadrunner
> >
> >
> >
> >
> >
> > -----------------------------------------------------------------------=
=2D-
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your opinions on IT & business topics through brief surveys - and earn
> > cash
> > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=
=3DDEVDEV
> > _______________________________________________
> > QuantLib-dev mailing list
> > Qua...@li...
> > https://lists.sourceforge.net/lists/listinfo/quantlib-dev
=2D-=20
=2D------------------------------------------------------------------------=
=2D-----
Joseph Wang Ph.D. - jo...@gn... =20
China Derivatives Researcher and Software Developer - QuantLib
http://en.wikiversity.org/wiki/User:Roadrunner
|