C++ Member Function Detector Macro

In C++, we often use the substitution failure is not an error (SFINAE) rule in template overload resolution. A common problem is to write template specializations for class template arguments that expose member functions with a certain signature. The below macro allows to easily create member function detector type traits for user defined classes

Continue reading

Automatic (Differentiation) for the COS Method

In the last post, I provided a brief introduction to forward mode automatic differentiation with CppAD. In this post, I propose to use automatic differentiation for the computation of cumulants of option pricing models based on characteristic functions. This is useful, for example, when pricing European vanilla options using the Fang and Oosterlee (2008) COS method. Here, the first four cumulants are used to determine the integration range.

Continue reading

Automatic Differentiation with CppAD

In quantitative finance, automatic differentiation is commonly used to efficiently compute price sensitivities. See Homescu (2011) for a general introduction and overview. I recently started to look into it with two different applications in mind: i) computation of moments from characteristic functions and ii) computation of implied densities from parametric volatility smiles. In this post, I provide a short introduction into computing general order derivatives with CppAD in forward mode.

Continue reading