Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logsumexp(f, x) (and logsumexp!(f, out, x)) #55

Open
theogf opened this issue Jul 14, 2022 · 1 comment
Open

logsumexp(f, x) (and logsumexp!(f, out, x)) #55

theogf opened this issue Jul 14, 2022 · 1 comment

Comments

@theogf
Copy link

theogf commented Jul 14, 2022

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

@devmotion
Copy link
Member

Would it be just

logsumexp(f, x) = logsumexp(f(xi) for xi in x)

? Or maybe

logsumexp(f, x; dims=:) = logsumexp(Broadcast.instantiate(Broadcast.broadcasted(f, x)); dims=dims)
  • changing ::AbstractArray to ::Base.AbstractArrayOrBroadcasted?

In any case, I think it could be convenient even though at least the first alternative already works. So I guess a PR would be great 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants