clad
clad copied to clipboard
Support higher order custom derivatives
#include "clad/Differentiator/Differentiator.h"
double mysin(double x) { return std::sin(x); }
auto g = clad::differentiate<2>(mysin);
Outputs:
T.cpp:12:42: warning: function 'sin_darg0' was not differentiated because clad failed to differentiate it and no suitable overload was found in namespace 'custom_derivatives', and function may not be eligible for numerical differentiation.
double mysin(double x) { return std::sin(x); }
^
2 warnings generated.