a class for accessing sub-matrices of arbitrary sub-dimensions