Fast multidimensional iteration