logsumexp works