How about having a version that takes a function to avoid allocation when doing `logsumexp(f.(x))` ? Would you be open to a PR?