new autodiff.hpp for functor-based derivatives