Matlab Port
Posted by mrtreibe on Feb 05, 2003; 6:21am
URL: http://quantlib.414.s1.nabble.com/Matlab-Port-tp2390.html
Hello everyone.
I'm going to be taking a crack at a matlab port of QuantLib and I wanted
to see if anyone had any thoughts.
The largest item nagging at the back of my mind is the exact method of
binding in the Quantlib library. SWIG doesn't (yet) support Matlab so
this will have to be handwritten. Unfortunately the best way that I
know of doing this is with a large switch statement inside a cmex file
(c implemented matlab file). For those that don't know matlab, I'll
explain:
Matlab requires that each function be implemented in a separate file
(with classes implemented in a special directory structure). If each
Quantlib function were implemented as a separate cmex file (which are
compiled as .dlls), they would also require an accompanying m-function
file to provide the function prototype and help information.
Because of this nature the only way that I know of to manageably work
with lots of external functions within matlab is to group them together
inside one large cmex file. I was thinking of writing one cmex function
for each major Quantlib class. This way it keeps the cmex side of the
operation down to about 15 or so files to manage instead of hundreds.
If anyone can suggest a better way I'd be grateful; one large switch
statement just makes me feel dirty.
Apart from that I'm going to look at how the Ruby and Python ports are
implemented. Although matlab does support a class structure it is quite
common (and useful) for function calls to also allow many parameters.
Perhaps an implementation that allows pre-defined class variables to be
temporarily overwritten during a function evaluation would keep both the
nature of QuantLib and Matlab intact.
Mark.