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
Bessel function of higher order #5897
base: develop
Are you sure you want to change the base?
Conversation
Can one of the admins verify this patch? |
If you end up rebasing for whatever reason, there's a typo in the first commit message, 'fucntions' |
OK to test |
oh, will then squash |
I'm not a Kokkos dev, but would you consider calling the existing mathematical special functions where appropriate?
Not using existing implementations where possible risks pessimizing both performance and accuracy. |
76e2055
to
a8ecfc1
Compare
Hi, here is small example of how this functions can be called
I think it is a good idea to have bessel functions for real types in Kokkos namespace so users can just call |
My comment relates to the implementation of these functions, not their interface. Anyway, please carry on : - ) |
@Yaraslaut
auto kokkos_complex = Kokkos::complex<double>{2.0,2.0};
cyl_bessel_j<decltype(kokkos_complex),double,int>(2,kokkos_complex); I think it would be useful to allow doing this: auto kokkos_complex = Kokkos::complex<double>{2.0,2.0};
cyl_bessel_j(2,kokkos_complex); where this could be handled as: template <class RealType, class IntType>
KOKKOS_INLINE_FUNCTION CmplxType cyl_bessel_j(const IntType a,
const Kokkos::complex<RealType> & z,
const RealType& joint_val = 25,
const IntType& bw_start = 70) {
|
Thanks for reviewing this PR, I will try to address this issues, and let you know once it is ready for further review. |
9f95bc2
to
925b36d
Compare
Retest this please. |
Looks like the the test fails when using
|
@masterleinad No I don't think so. I think that's the compiler bug that we discussed earlier in this PR. We just need to disable the failing tests for ROCm 5.5 and 5.6 |
Even better! |
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.
Not a complete review. Just some obeservations.
We still need to disable the tests failing for |
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.
Apart from testing the public interface instead of the function in Impl
, this looks good to me (pending CI).
d_cby0(i) = Kokkos::Experimental::cyl_bessel_y0<Kokkos::complex<double>, | ||
double, int>(d_z(i)); | ||
d_cbj0(i) = | ||
Kokkos::Experimental::Impl::cyl_bessel_j0<Kokkos::complex<double>, |
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.
Can you please change all of these to use/test the public interface?
Kokkos::Experimental::cyl_bessel_k(6, 1.0); | ||
Kokkos::Experimental::cyl_bessel_y(6, 1.0); | ||
Kokkos::Experimental::cyl_bessel_h1(6, 1.0); | ||
Kokkos::Experimental::cyl_bessel_h2(6, 1.0); |
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.
what is being tested here? just that it compiles?
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.
Yes, only that it properly deducing templates, i can also add tests for the numerical value of those
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.
Please do.
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.
I added tests for higher orders for both real and complex arguments, and I was lucky to find out divergene between results taken from octave and julia. So I need to rethink implementation, if anyone have any ideas i will be happy to hear them
You'll have to fix the indentation. |
Thanks, for pointing this our,otherwise i would discover it only after a while. I tried to addres all issues, still not sure what to do with large arguments since they require customization of default variables to get proper result |
making this a draft following the comment: #5897 (comment) |
Search for an existing implementation led me to discover implementation of Bessel function by Amos[1]. You can see this is a Fortran code and i am not sure if kokkos wants to link/compile this library, perhaps @fnrizzi or @masterleinad can advice how we can proceed with this PR. [1] https://netlib.org/amos/ |
I don't think we want to use an external library just to be able to use Bessel functions (and does that even work with the GPU backends?). I would prefer just adopting a suitable implementation and converting it to |
i agree with Daniel! |
@masterleinad @fnrizzi existing libraries does not support complex arguments, for example see boost: boostorg/math#689 |
This PR adds Bessel functions of higher order (#5637)
TODO: