Compute the Bessel function for each element of an array. More...

Modules

 af_bessel
 The C interface for Bessel functions.
 

Detailed Description

Compute the Bessel function for each element of an array.

For the canonical Bessel function (and several of its variants), compute the value of the function for each element or the array.

The Bessel functions are the canonical solutions to Bessel's differential equation:

\( x^2 \frac{d^2x}{dx^2} + x \frac{dy}{dx} + (x^2 - \alpha^2)y = 0 \)

Examples:

float ha[] = {1, 2, 3, 4, 5};
array a = array(5, 1, ha);
array out = array(5, 1, f32);
float* p_in = a.device<float>();
float* p_out = out.device<float>();
// Modified first kind
af_besseli_S(p_out, 5, p_in, 2.0);
print(out);
// out =
// 0.1357
// 0.6889
// 2.2452
// 6.4222
// 17.5056
// Canonical first kind
af_besselj_S(p_out, 5, p_in, 2.0);
print(out);
// out =
// 0.1149
// 0.3529
// 0.4881
// 0.3643
// 0.0466
// Modified second kind
af_besselk_S(p_out, 5, p_in, 2.0);
print(out);
// out =
// 1.6248
// 0.2538
// 0.0615
// 0.0174
// 0.0053