-
-
Notifications
You must be signed in to change notification settings - Fork 190
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
Minor fixes for hypergeometric 1F0 and 2F1 #3165
base: develop
Are you sure you want to change the base?
Conversation
Just rolled the 2F1 fixes into this PR as well instead of making a separate one |
Not sure if you want to look at it here, but By contrast, Neither of these are strictly necessary for exposing in the language, but if we want consistency they'd be nice to address |
@andrjohns the rev specialization of auto pfq_val = hypergeometric_pFq(a.val(), b.val(), value_of(z)); should be auto pfq_val = hypergeometric_pFq(arena_a.val(), arena_b.val(), value_of(z)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can go in as is (assuming you don't want to look at the vector issues mentioned above)
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
The vector issues were pretty simple fixes, so I've just added them as well |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
@andrjohns I think the (hopefully) last thing is that hypergeometric_3F2 isn't expression safe (does a sum and a to_vector, both of which will eval) and also does indexing into |
Would it make sense if something like 3F2 had a signature |
It looks like this change missed the |
Jenkins Console Log Machine informationNo LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focalCPU: G++: Clang: |
We probably don't need to expose both pFq and 3F2 tbh. The only extra thing in 3F2 is manual handling of a particular case which doesn't meet convergence criteria but numerically converges that was already in the tests, so I'd consider that more of an edge case. |
Fine by me, though if it’s easy enough there’s no reason to not add them I guess. Do you have a chance to look at rev/fwd for pFq with the vector changes? |
Summary
As pointed out in the stanc3 repo, the hypergeometric 1F0 function naming is inconsistent with the others - using a lowercase 'f' (i.e.,
hypergeometric_1f0
instead ofhypergeometric_1F0
)Additionally,
hypergeometric_2F1
fails to compile if the second argument is an autodiff type but not the othersTests
N/A - existing tests should still pass
Side Effects
N/A
Release notes
Renamed
hypergeometric_1f0
tohypergeometric_1F0
for consistency, fixed compilation forhypergeometric_2f1
with autodiff second argumentChecklist
Copyright holder: Andrew Johnson
The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
- Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
- Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)
the basic tests are passing
./runTests.py test/unit
)make test-headers
)make test-math-dependencies
)make doxygen
)make cpplint
)the code is written in idiomatic C++ and changes are documented in the doxygen
the new changes are tested