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