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

A log_add_exp function that returns containers #3127

Open
WardBrian opened this issue Nov 15, 2024 · 6 comments
Open

A log_add_exp function that returns containers #3127

WardBrian opened this issue Nov 15, 2024 · 6 comments

Comments

@WardBrian
Copy link
Member

It would be nice to have a function that works like log_sum_exp but elementwise, so the return was also a container.

I have a similar issue with log_sum_exp where I wanted it to vector[n] a = log_sum_exp(vector[n] b, vector[n] c) across each element, however it doesn't do this type of elementwise sum. Maybe if we had a log_add_exp which I've seen in other languages.

Originally posted by @spinkney in stan-dev/docs#832 (comment)

@MichaScant
Copy link

Hi, can I be assigned this issue?

@WardBrian
Copy link
Member Author

Hi @MichaScant -- we don't really use the 'assign' feature of GitHub, but if you want to go ahead and tackle this, feel free!

@spinkney
Copy link
Collaborator

@WardBrian we have a log_diff_exp. Should we also add a log_subtract_exp?

@WardBrian
Copy link
Member Author

@spinkney if it would be useful, but probably easiest to have as a separate issue

@MichaScant
Copy link

Hello, I am in the middle of building the test file using log_sum_exp_test as an example and noticed you were passing in logSumExp into the test

Screenshot 2024-11-22 at 7 28 25 PM

Would I have to initialize an equivalent logAddExp and how would that occur? Or is there a substitute I can use? Thank you

@WardBrian
Copy link
Member Author

The two arguments there are test group and test name, so you can just write the logAddExp without having to do any more code

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

No branches or pull requests

3 participants