-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
ENH: special: add logiv
and logive
#12641
base: main
Are you sure you want to change the base?
Conversation
@WarrenWeckesser I'd like to hear your opinion if these are worth including. |
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.
A couple of drive-by comments, not a definitive review:
-
it'd be nice to deduplicate with _hyp0f1, if possible
-
the test_mpmath machinery is very useful for smoking out corner cases. Would be nice to include this
-
best ensure that what you add here is available from the cython_special interface.
-
these functions should be ufuncs, so cython kernels need to be hooked up into the ufunc-generation machinery
scipy/special/log_iv.py
Outdated
""" | ||
Log of modified Bessel function of the first kind of real order. | ||
|
||
See `iv` for Parameters and return |
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.
Provably want to add a See Also section
scipy/special/log_iv.py
Outdated
|
||
__all__ = ['logiv', 'logive'] | ||
|
||
def logiv(v, 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.
Maybe move the dispatch to Cython, so that cython_special interface is consistent.
@ev-br These are very useful.
I keep this in mind but won't look at it till we're closer to the end.
I wasn't aware of this test; I added a
Can you point me at some links for doing this? I'm trying to follow 4e86352 but I'm still missing something. |
Makes sense! Re ufuncs: you'll need to add an entry to functions.json, the docstrings go to add_newdocs.py. I'm not sure about the moving parts now: It used to be necessary to run The most authoritative review should be from Josh or Pauli. |
I don't believe this is needed anymore; I defined my function in |
Seems to work?
However, I'm not sure what is the end goal here: is it really useful to add the asymptotic expansion ufunc to the API (albeit a private part of it). I suspect you'll change it later so that |
9463bcf
to
f368804
Compare
logiv
and logive
CC @fancidev : these functions would come in very handy for statistical computations, e. g. the Von Mises-Fisher distribution, in case you are interested ;) |
@dschmitz89 The log BesselI function would be very useful. I also wanted it (as well as log BesselK function) when I worked on a compound Poisson process. The However, I guess it’s quite challenging to write a solid |
logiv
and logive
logiv
and logive
Fixes #12607
I'm not sure if this is the right structure, the right place, or the right name.
logiv
,log_iv
,lniv
,ivln
context: scipy.special contains
ndtr(x)
andlog_ndtr(x)
|gamma(z)
,gammaln(x)
, andloggamma(z)
|beta(a, b)
,betaln(a, b)
I'm not sure what precision goal I should aim for;
v
is large but can be as high as1e-9
when v is just greater than the threshold.I'm not sure if I need to support complex numbers for these functions.
I don't yet support array/arraylike input.