= np.zeros((2, 2), dtype=np.int)print("1:" + str(submatrix))>>>2:[[1 2] # since submatrix[0,0] didn't change to 0, elements must have been[:2,:2] = x[:2, :2] # perform same a
all possible 8x8 submatrices # extract 8x8 submatrixfrom the matrix # do some work on the submatrixfoo(submatrix)
问题是:上面的代码可以很好地工作到n=30x30矩阵(大约有500万个可能