Feedback request 1 - templated lattices

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

Feedback request 1 - templated lattices

Luigi Ballabio-2
Hi all,
     part 1 of 3 in a feedback-request frenzy:

in August---when I probably had too much time on my hands---I made some
tentative development. Following the thread we had in July about the merits
of template code against more classical polymorphism, I experimented with
some of the code for binomial trees and reimplemented it with template
techniques. The result is available for review at
<http://quantlib.org/review/> where I uploaded a QuantLib tarball which
includes the new code. Unfortunately, the tarball is kind of outdated (it
is based on a pre-0.3.3 snapshot) but you can pretty much get the idea by
looking at files called *2.hpp and *2.cpp. I also uploaded two test files
at the same location. The test with the number 1 in its filename uses the
old code, while the one with the 2 uses the new template classes.

Now, my dilemma is: on the one hand, the new code is more heavily templated
and might be more difficult to use---more so if all the lattice framework
were to be converted (right now it's just the binomial option engines.) On
the other hand, on my Linux box and with gcc 3.2 fully optimizing the code,
it is 300 % faster. I have no idea what the savings could be on
Windows---frankly, I don't even know if the thing compiles :)

Have a look, and let me know what you think.

Later,
         Luigi