def schur_complement(mat, row, col):
    """ compute the schur complement of the matrix block mat[row:,col:] of the matrix mat """
    a = mat[:row, :col]
    b = mat[:row, col:]
    c = mat[row:, :col]
    d = mat[row:, col:]
    return a - b.dot(d.I).dot(c)
compute the schur complement of the matrix block mat[row:,col:] of the matrix mat