Added first autodiff version, with only scalars computation.