Visible to Intel only — GUID: GUID-59996889-089C-4574-A1C3-6FE32E3E8AB8
Visible to Intel only — GUID: GUID-59996889-089C-4574-A1C3-6FE32E3E8AB8
erfc
Computes the element-wise complementary error function of vector elements.
Description
The erfc function computes the complementary error function values for elements of the input vector a and writes them to the output vector y.
The complementary error function is defined as follows:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/5817F266-CF0D-439A-B97A-DB579779EA02-low.png)
Useful relations:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/CFB6F3ED-C309-491A-8584-8EE1D408B7A5-low.png)
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/73546088-B56D-45D7-B3D5-FBF393840BFA-low.png)
where
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/696F6D64-3CA9-47FA-944F-67E92B75CFAF-low.png)
is the cumulative normal distribution function.
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/18969177-45D3-4081-BFA2-1921E36F4911-low.png)
where and erf-1(x) are the inverses to
and erf(x), respectively.
The following figure illustrates the relationships among erf family functions (erf, erfc, cdfnorm).
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/8058E694-1736-451A-8C35-332BA227EE4A-low.png)
Useful relations for these functions:
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/952231A3-BE9C-4B5E-AE7E-4C72FA975537-low.png)
![](/content/dam/docs/us/en/developer-reference-dpcpp/2023-2/4F5B7FE9-4030-4483-BBEE-6FD22BFE7929-low.png)
Argument |
Result |
Error Code |
---|---|---|
a > underflow |
+0 |
status::underflow |
+ |
+0 |
|
- |
+2 |
|
QNAN |
QNAN |
|
SNAN |
QNAN |
API
Syntax
Buffer API
namespace oneapi::mkl::vm { sycl::event erfc(sycl::queue & exec_queue, std::int64_t n, sycl::buffer<T> & a, sycl::buffer<T> & y, oneapi::mkl::vm::mode mode = oneapi::mkl::vm::mode::not_defined, oneapi::mkl::vm::error_handler<T> errhandler = {}); }
namespace oneapi::mkl::vm { sycl::event erfc(sycl::queue & exec_queue, sycl::buffer<T> & a, oneapi::mkl::slice sa, sycl::buffer<T> & y, oneapi::mkl::slice sy, oneapi::mkl::vm::mode mode = oneapi::mkl::vm::mode::not_defined, oneapi::mkl::vm::error_handler<T> errhandler = {}); }
USM API
namespace oneapi::mkl::vm { sycl::event erfc(sycl::queue & exec_queue, std::int64_t n, T const * a, T * y, std::vector<sycl::event> const & depends = {}, oneapi::mkl::vm::mode mode = oneapi::mkl::vm::mode::not_defined, oneapi::mkl::vm::error_handler<T> errhandler = {}); }
namespace oneapi::mkl::vm { sycl::event erfc(sycl::queue & exec_queue, T const * a, oneapi::mkl::slice sa, T * y, oneapi::mkl::slice sy, std::vector<sycl::event> const & depends = {}, oneapi::mkl::vm::mode mode = oneapi::mkl::vm::mode::not_defined, oneapi::mkl::vm::error_handler<T> errhandler = {}); }
erfc supports the following precisions and devices:
T |
Devices supported |
---|---|
float |
CPU and GPU |
double |
CPU and GPU |
Input Parameters
Buffer API
- exec_queue
-
The queue where the routine should be executed.
- n
-
Specifies the number of elements to be calculated.
- a
-
The buffer containing the input vector.
- sa
-
Slice selector for a. See Data Types for a description of the oneMKL slice type.
- sy
-
Slice selector for y. See Data Types for a description of the oneMKL slice type.
- mode
-
Overrides the global VM mode setting for this function call. See the set_mode function for possible values and their description. This is an optional parameter. The default value is mode::not_defined.
- errhandler
-
Sets local error handling mode for this function call. See the create_error_handler function for arguments and their descriptions. This is an optional parameter. The local error handler is disabled by default.
USM API
- exec_queue
-
The queue where the routine should be executed.
- n
-
Specifies the number of elements to be calculated.
- a
-
Pointer to the input vector.
- sa
-
Slice selector for a. See Data Types for a description of the oneMKL slice type.
- sy
-
Slice selector for y. See Data Types for a description of the oneMKL slice type.
- depends
-
Vector of dependent events (to wait for input data to be ready). This is an optional parameter. The default is an empty vector.
- mode
-
Overrides the global VM mode setting for this function call. See the set_mode function for possible values and their description. This is an optional parameter. The default value is mode::not_defined.
- errhandler
-
Sets local error handling mode for this function call. See the ref:create_error_handler function for arguments and their descriptions. This is an optional parameter. The local error handler is disabled by default.
Output Parameters
Buffer API
- y
-
The buffer containing the output vector.
- return value (event)
-
Computation end event.
USM API
- y
-
Pointer to the output vector.
- return value (event)
-
Computation end event.
Examples
An example of how to use erfc can be found in the oneMKL installation directory, under:
examples/dpcpp/vml/source/verfc.cpp