I have a matrix such that
Eigen::MatrixXd mat(5,10,20);
I want to reduce this to an 5 by 10 matrix by summing along the last dimension. If it were a 2d matrix, I could use colwise() or rowwise(). Is there something I can use here? Or do I need to loop through all elements?