def into2dBlocks ( arr , n0 , n1 ) : s0 , s1 = arr . shape b = blockshaped ( arr , s0 // n0 , s1 // n1 ) return b . reshape ( n0 , n1 , * b . shape [ 1 : ] )
python blocks of same values matrix
similar to blockshaped but splits an array into n0 * n1 blocks
def into2dBlocks(arr, n0, n1):
    """
    similar to blockshaped
    but splits an array into n0*n1 blocks
    """
    s0, s1 = arr.shape
    b = blockshaped(arr, s0// n0, s1// n1)
    return b.reshape(n0, n1, *b.shape[1:])