Test mean_r/sum_r with more dimensions
Add support for higher-D matrices