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

init keyword for logsumexp and co #68

Closed
theogf opened this issue Apr 21, 2023 · 2 comments
Closed

init keyword for logsumexp and co #68

theogf opened this issue Apr 21, 2023 · 2 comments

Comments

@theogf
Copy link

theogf commented Apr 21, 2023

It would be great to have a init keyword similar to sum for empty collections.

I would basically expect

logsumexp(Float64[]) == -Inf

It just makes it slightly complicated to make it type stable so I am not sure how to go about this.

@theogf
Copy link
Author

theogf commented Apr 21, 2023

Ok my bad, this example already works....
I probably have a type issue somewhere.

@theogf theogf closed this as completed Apr 21, 2023
@theogf
Copy link
Author

theogf commented Apr 21, 2023

For context, this is my issue:

d = Dict(rand(3) .=> rand(3))
[x for (k, x) in pairs(d) if k > 1] # This is type stable
logsumexp(x for (k,x) in pairs(d) if k > 1) # This errors

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

1 participant