G2Process in QuantLib-Swig

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

G2Process in QuantLib-Swig

André de Boer
Hello All,

In the header file  StochasticProcess.hpp  in the class
StochasticProcess there is an method:

virtual Disposable<Array> evolve(Time t0, const Array& x0, Time dt,
const Array& dw)

that I need in python, so I can do:

ir = g2Process->evolve(t, ir, dt, dz).

But in the file  stochasticprocess.i  I only see:

%{
using QuantLib::StochasticProcess;
%}
%ignore StochasticProcess;
class StochasticProcess {};
%template(StochasticProcess) boost::shared_ptr<StochasticProcess>;
IsObservable(boost::shared_ptr<StochasticProcess>);

How can I add this method  'evolve'   to this class StochasticProcess?
I have already added G2Process to the file stochasticprocess.i :

%{
using QuantLib::G2Process;
typedef boost::shared_ptr<StochasticProcess> G2ProcessPtr;
%}

%rename(G2Process) G2ProcessPtr;
class G2ProcessPtr : public boost::shared_ptr<StochasticProcess> {
  public:
    %extend {
       G2ProcessPtr(Real a, Real sigma, Real b, Real eta, Real rho) {
            return new G2ProcessPtr(new G2Process(a, sigma, b, eta, rho));
       }
    }
};


Kind regards,
André de Boer

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: G2Process in QuantLib-Swig

Luigi Ballabio
Hi André,
    the version of QuantLib-SWIG now on GitHub's master at https://github.com/lballabio/QuantLib-SWIG should expose the interface. If you add your G2ProcessPtr to stochasticprocess.i, it will inherit it.

Luigi


On Tue, Nov 17, 2015 at 4:45 PM André de Boer <[hidden email]> wrote:
Hello All,

In the header file  StochasticProcess.hpp  in the class
StochasticProcess there is an method:

virtual Disposable<Array> evolve(Time t0, const Array& x0, Time dt,
const Array& dw)

that I need in python, so I can do:

ir = g2Process->evolve(t, ir, dt, dz).

But in the file  stochasticprocess.i  I only see:

%{
using QuantLib::StochasticProcess;
%}
%ignore StochasticProcess;
class StochasticProcess {};
%template(StochasticProcess) boost::shared_ptr<StochasticProcess>;
IsObservable(boost::shared_ptr<StochasticProcess>);

How can I add this method  'evolve'   to this class StochasticProcess?
I have already added G2Process to the file stochasticprocess.i :

%{
using QuantLib::G2Process;
typedef boost::shared_ptr<StochasticProcess> G2ProcessPtr;
%}

%rename(G2Process) G2ProcessPtr;
class G2ProcessPtr : public boost::shared_ptr<StochasticProcess> {
  public:
    %extend {
       G2ProcessPtr(Real a, Real sigma, Real b, Real eta, Real rho) {
            return new G2ProcessPtr(new G2Process(a, sigma, b, eta, rho));
       }
    }
};


Kind regards,
André de Boer

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users