Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

IMF Device Library Special Functions

The IMF Device Library supports the following special functions and their inverses:

cdfnorm

Description: The cdfnorm(x) function returns the cumulative normal distribution function value of x.

This function is a useful one for Monte Carlo applications in computational finance.

                               2
                         x   -t 
                         -   ---  
                1       | |   2
cdfnorm(x) = -------  · |   e    dt
             sqrt(2π) | |
                       -
                      -∞ 

Special Values:

Argument x Result cdfnorm(x)
-∞ +0
x < UDFL +0
+∞ +1
NOTE:
UDFL is the underflow threshold. UDFL = ~ -14.2 for float, ~ -38.5 for double precisions.

Useful Identities:

cdfnorm(x) = 1/2 · ( 1 + erf( x/sqrt(2) ) )
cdfnorm(x) = 1 - 1/2 · erfc( x/sqrt(2) )

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::cdfnorm ( float x );
double      sycl::ext::intel::math::cdfnorm ( double x );

// CUDA-specific naming for the same functions
float       sycl::ext::intel::math::cdfnorm ( float x );
double      sycl::ext::intel::math::cdfnorm ( double x );

cdfnorminv

Description: The cdfnorminv(x) function returns the inverse cumulative normal distribution function value of x.

This function is a useful one for Monte Carlo applications in computational finance.

Special Values:

Argument x Result cdfnorminv(x)
-∞ QNAN
x < -0 QNAN
+/-0 -∞
+0.5 +0
+1 +∞
x > +1 QNAN
+∞ QNAN

Useful Identities:

cdfnorminv(x) = sqrt(2) · erfinv( 2·x - 1 )
cdfnorminv(x) = sqrt(2) · erfcinv( 2 - 2·x )

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::cdfnorminv ( float x );
double      sycl::ext::intel::math::cdfnorminv ( double x );

// CUDA-specific naming for the same functions
float       sycl::ext::intel::math::normcdfinv ( float x );
double      sycl::ext::intel::math::normcdfinv ( double x );

cyl_bessel_i0

Description: The cyl_bessel_i0(x) function returns the value of the regular modified cylindrical Bessel function of an order of 0 for the input argument x.

                             2k
                   +∞   (x/2)
cyl_bessel_i0(x) =  Σ  ---------
                   k=0  k!Γ(k+1)

Special Values:

Argument x Result cyl_bessel_i0(x)
-∞ +∞
+/-0 +1
+∞ +∞

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::cyl_bessel_i0 ( float x );
double      sycl::ext::intel::math::cyl_bessel_i0 ( double x );

cyl_bessel_i1

Description: The cyl_bessel_i1(x) function returns the value of the regular modified cylindrical Bessel function of an order of 1 for the input argument x.

                             2k+1
                   +∞   (x/2)
cyl_bessel_i0(x) =  Σ  ---------
                   k=0  k!Γ(k+2)

Special Values:

Argument x Result cyl_bessel_i1(x)
-∞ -∞
+/-0 +/-0
+∞ +∞

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::cyl_bessel_i1 ( float x );
double      sycl::ext::intel::math::cyl_bessel_i1 ( double x );

erf

Description: The erf(x) function returns the error function value of x.

                        x
                        -     2
                2      | |  -t 
 erf(x)  =   -------·  |   e    dt
             sqrt(π) | |
                      -
                      0

Special Values:

Argument x Result erf(x)
-∞ -1
+∞ +1

Useful Identities:

erf(x) = 1 - erfc(x)

Calling Interfaces:

  • Default accuracy:
    float       sycl::ext::intel::math::erf ( float x );
    double      sycl::ext::intel::math::erf ( double x );
  • High accuracy (HA):
    float       sycl::ext::intel::math::ha::erf ( float x );
    double      sycl::ext::intel::math::ha::erf ( double x );
  • Low accuracy (LA):
    float       sycl::ext::intel::math::la::erf ( float x );
    double      sycl::ext::intel::math::la::erf ( double x );
  • Enhanced performance:
    float       sycl::ext::intel::math::ep::erf ( float x );
    double      sycl::ext::intel::math::ep::erf ( double x );

erfc

Description: The erfc(x) function returns the complementary error function value of x: 1 - erf(x)

This function is useful when erf(x) is close to 1 to obtain greater accuracy.

                        ∞
                        -     2
                2      | |  -t 
 erfc(x) =   -------·  |   e    dt
             sqrt(π) | |
                      -
                      x

Special Values:

Argument x Result erfc(x)
-∞ +2
x > UDFL +0
+∞ +0
NOTE:
UDFL is underflow threshold. UDFL = ~9.2 for float, ~26.6 for double precisions.

Useful Identities:

erfc(x) = 1 - erf(x)

Calling Interfaces:

  • Default accuracy:
    float       sycl::ext::intel::math::erfc ( float x );
    double      sycl::ext::intel::math::erfc ( double x );
  • High accuracy (HA):
    float       sycl::ext::intel::math::ha::erfc ( float x );
    double      sycl::ext::intel::math::ha::erfc ( double x );
  • Low accuracy (LA):
    float       sycl::ext::intel::math::la::erfc ( float x );
    double      sycl::ext::intel::math::la::erfc ( double x );

erfcinv

Description: The erfcinv(x) function returns the inverse complementary error function value of x: erfinv(1-x).

The inverse complementary error function is useful for Monte Carlo applications in computational finance as it is closely related to the normal cumulative distribution. Use the erfcinv(x) function to replace expressions containing erfinv(1-x) for greater accuracy when x is close to 1.

Special Values:

Argument x Result erfcinv(x)
-∞ QNAN
x < -0 QNAN
+/-0 +∞
+1 +0
+2 -∞
x > +0 QNAN
+∞ QNAN

Useful Identities:

erfcinv(x) = erfinv(1-x)

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::erfcinv ( float x );
double      sycl::ext::intel::math::erfcinv ( double x );

erfcx

Description: The erfcx(x) function returns the scaled complementary error function value of x: exp(x^2)·erfc(x).

This computation sequence occurs in diffusion problems of physics and chemistry and may be useful to avoid underflow and overflow errors computing exp(x^2) and erfc(x) separately.

Special Values:

Argument x Result erfcx(x)
-∞ +∞
+∞ +0

Useful Identities:

erfcx(x) ~ (1/sqrt(π))/x, for large x

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::erfcx ( float x );
double      sycl::ext::intel::math::erfcx ( double x );

erfinv

Description: The erfinv(x) function returns the inverse error function value of x.

The inverse error function is useful for Monte Carlo applications in computational finance as it is closely related to the normal cumulative distribution.

Special Values:

Argument x Result erfinv(x)
-∞ QNAN
+/-0 +/-0
+/-1 +/-∞
|x| > 1 QNAN
+∞ QNAN

Useful Identities:

erfinv(x) = erfcinv(1-x)

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::erfinv ( float x );
double      sycl::ext::intel::math::erfinv ( double x );

j0

Description: The j0(x) function returns the value of the Bessel function of the first kind of order 0 for the input argument x.

                 k     2k
        +∞   (-1)·(x/2) 
j0(x) =  Σ  -------------
        k=0   (k!)·(k)!

Special Values:

Argument x Result j0(x)
-∞ +0
+/-0 +1
+∞ +0

Calling Interfaces:Default accuracy:

float       sycl::ext::intel::math::j0 ( float x );
double      sycl::ext::intel::math::j0 ( double x );

j1

Description: The j1(x) function returns the value of the Bessel function of the first kind of order 1 for the input argument x.

                 k     2k+1
        +∞   (-1)·(x/2) 
j1(x) =  Σ  -------------
        k=0  (k!)·(k+1)!

Special Values:

Argument x Result j1(x)
-∞ +0
+/-0 +/-0
+∞ +0

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::j1 ( float x );
double      sycl::ext::intel::math::j1 ( double x );

jn

Description: The jn(n,x) function returns the value of the Bessel function of the first kind of given order n for the input argument x.

                 k     n+2k
        +∞   (-1)·(x/2) 
jn(x) =  Σ  -------------
        k=0  (k!)·(n+k)!

Special Values:

Argument n Argument x Result jn(n,x)
any -∞ +0
0 +/-0 +1
n >= 1 +/-0 +/-0
any +∞ +0

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::jn ( int n, float x );
double      sycl::ext::intel::math::jn ( int n, double x );

lgamma

Description: The lgamma(x) function returns the value of the natural logarithm of the absolute value of gamma: log( |tgamma(x)| ).

Special Values:

Argument x Result lgamma(x)
-∞ +∞
neg, int +∞
+/-0 +∞
+1 +0
+2 +0
+∞ +∞

Useful Identities:

lgamma(x) = log(|tgamma(x)|), less accurate and impacted by overflows in tgamma

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::lgamma ( float x );
double      sycl::ext::intel::math::lgamma ( double x );

tgamma

Description: The tgamma(x) function returns the gamma function value of x.

              ∞
              -         
             | |  x-1  -t 
tgamma(x) =  |   t  · e   dt
           | |
            -
            0

Special Values:

Argument x Result tgamma(x)
-∞ QNAN
neg, int QNAN
+/-0 +/-∞
x > OVFL +∞
+∞ +∞
NOTE:
OVFL is the overflow threshold. OVFL = ~ 35.1 for float, ~ 171.7 for double precisions.

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::tgamma ( float x );
double      sycl::ext::intel::math::tgamma ( double x );

y0

Description: The y0(x) function returns the value of the Bessel function of the second kind of order 0 for the input argument x.

Special Values:

Argument x Result y0(x)
-∞ QNAN
x < +0 QNAN
+/-0 -∞
+∞ +0

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::y0 ( float x );
double      sycl::ext::intel::math::y0 ( double x );

y1

Description: The y1(x) function returns the value of the Bessel function of the second kind of order 1 for the input argument x.

Special Values:

Argument x Result y0(x)
-∞ QNAN
x < +0 QNAN
+/-0 -∞
+∞ +0

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::y1 ( float x );
double      sycl::ext::intel::math::y1 ( double x );

yn

Description: The yn(n,x) function returns the value of the Bessel function of the second kind of given order n for the input argument x.

                              n 
         jn(x)·cos(n·π) - (-1)·jn(x)
yn(x) =  ---------------------------
                   sin(n·π)        

Special Values:

Argument n Argument x Result yn(n,x)
any -∞ QNAN
any x < +0 QNAN
any +/-0 -∞
any +∞ +0

Calling Interfaces:

Default accuracy:

float       sycl::ext::intel::math::yn ( int n, float x );
double      sycl::ext::intel::math::yn ( int n, double x );