C++ Techniques For High Performance Financial Modelling
Free (open access)
In this paper, several C++ techniques, such as eliminating temporary objects, swapping vectors, utilizing the Matrix Template Library (MTL), and computing at compile-time, are shown to be highly effective when applied to the design of high performance financial models. Primarily, the idea emphasized is to achieve high performance numerical computations by delaying certain evaluations and eliminating many compiler-generated temporary objects. In addition, the unique features of the C++ language, namely function and class templates, are applied to move certain run-time testing into the compiling phase and to decrease the memory usage and speed up performance. As an example, those techniques are used in implementing finite difference methods for pricing convertible bonds; the resulted code turns out to be really efficient. Keywords: C++, high performance, financial modelling, C++ template, Matrix Template Library, vector swapping, compile-time computation, convertible bond. 1 Introduction What do Adobe Systems, Amazon.com, Bloomberg, Google, Microsoft Windows OS and Office applications, SAP’s database, and Sun’s HotSpot Java Virtual Machine have in common? They are all written in C++ (Stroustrup ). Still, when people talk about high performance numerical computations, Fortran seems to be the de facto standard language of choice. To the author’s knowledge, C++ is actually widely used by Wall Street financial houses; as an example Morgan Stanley is mentioned by Stroustrup  on his website. Techniques developed in the past few years, such as expression
C++, high performance, financial modelling, C++ template, Matrix Template Library, vector swapping, compile-time computation, convertible bond.