Thanks Kamensky!
Just to add: Using the Eigen::Ref<> template instead of py::array_t<> , pybind11 casts numpy arrays directly and also gives access to the Eigen library methods.
i.e Change npArray definition to
typedef Eigen::Ref<Eigen::VectorXd> npArray;
arr declaration to npArray arr;
and the constructor method to
test_exp(npArray a) : dolfin::Expression(), arr(a) {}
This can help in using Eigen Methods e.g arr.sum() in the eval method.