def kahan_sum(p):
    """Kahan summation
    <https://en.wikipedia.org/wiki/Kahan_summation_algorithm>.
    """
    q = p.reshape(p.shape[0], -1)
    s = _accupy.kahan(q)
    return s.reshape(p.shape[1:])