def _partition(M):
    """Evenly partition a matrix into 4 blocks (2-by-2).
    """
    block_size = M.shape[0] // 2
    M_11 = M[: block_size, : block_size]
    M_12 = M[: block_size, block_size :]
    M_21 = M[block_size :, : block_size]
    M_22 = M[block_size :, block_size :]
    return (M_11, M_12, M_21, M_22)