http://quantlib.414.s1.nabble.com/using-quantlib-in-Matlab-tp9078p9082.html
wrappers for Quantlib. Matlab is written in Java and so it is easy to
load classes from there and call them.
On 11/5/2010 7:02 PM, steven e. pav wrote:
>
>
> hello;
>
>
> I am trying to use the quantlib library from Matlab. As a test case, I
> adapted the EquityOption.cpp example code from the quantlib webpage to a cpp
> file which would generate the price of an American Put option with parameters
> given by the user, using a few different pricing engines. Before writing the
> mex, I had created a standalone version which accepted input from std::cin, and
> this ran fine.
> However, when I run the code from matlab, the results always come back as 0. I
> do not know a lot about the guts of quantlib, and the lazy evaluation methods
> being used. However, it seems that when I run the standalone, it takes about 1
> second or so (there are some binomial lattice engines being used), whereas when
> I run the mex file from matlab, it returns zeros instantaneously. I suspect
> somehow that the<< operator in the standalone (copied from EquityOption.cpp)
> forces the option to be evaluated under the given engine, but this is not being
> done in my matlab mex.
> Am I wrong about this? Do I have to force evaluation somehow? As a snippet of
> code, I have things like this in the mex:
>
> americanOptionPut.setPricingEngine(boost::shared_ptr<PricingEngine>(
> new BinomialVanillaEngine<JarrowRudd>(bsmProcess,timeSteps)));
> P[iii] = (double)americanOptionPut.NPV(); //puts the results in the output
>
> whereas in the standalone it looks more like:
> americanOptionPut.setPricingEngine(boost::shared_ptr<PricingEngine>(
> new BinomialVanillaEngine<JarrowRudd>(bsmProcess,timeSteps)));
> std::cout<< "the result is "<< americanOptionPut.NPV()<< std::endl;
>
>
> any hints? thanks,
>
>
> --sep
>
>
> [ Steven E. Pav {bikes/bitters/linux} nerd ]
> [ google voice: 909.SHBYCHF shabbychef a.t gmail d0t com ]
> [ parent of tinyurl.com/oskarpix ]
> [ a palindrome: wondered now ]
>
>
> ------------------------------------------------------------------------------
> The Next 800 Companies to Lead America's Growth: New Video Whitepaper
> David G. Thomson, author of the best-selling book "Blueprint to a
> Billion" shares his insights and actions to help propel your
> business during the next growth cycle. Listen Now!
>
http://p.sf.net/sfu/SAP-dev2dev> _______________________________________________
> QuantLib-dev mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/quantlib-devDavid G. Thomson, author of the best-selling book "Blueprint to a
business during the next growth cycle. Listen Now!