https://stackoverflow.com/questions/23758490/iterate-over-all-but-d-th-dimension-of-any-boostmulti-array