Skip to content

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

Open

Description

@theogf

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

Activity

  1. devmotion commented on Jul 14, 2022

    @devmotion
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions