Avoid using memcpy when possible.
Optimize code using Eigen features.