Developer Reference for Intel® oneAPI Math Kernel Library for C
v?LinearFrac
vsLinearFrac vdLinearFrac vcLinearFrac vzLinearFrac Performs linear fraction transformation of vectors a and b with scalar parameters.
Syntax
vhLinearFrac ( n , a , b , scalea , shifta , scaleb , shiftb , y ) ;
vhLinearFracI(n, a, inca, b, incb, scalea, shifta, scaleb, shiftb, y, incy);
vmhLinearFrac ( n , a , b , scalea , shifta , scaleb , shiftb , y , mode ) ;
vmhLinearFracI(n, a, inca, b, incb, scalea, shifta, scaleb, shiftb, y, incy, mode);
vsLinearFrac ( n , a , b , scalea , shifta , scaleb , shiftb , y ) ;
vsLinearFracI(n, a, inca, b, incb, scalea, shifta, scaleb, shiftb, y, incy);
vmsLinearFrac ( n , a , b , scalea , shifta , scaleb , shiftb , y , mode ) ;
vmsLinearFracI(n, a, inca, b, incb, scalea, shifta, scaleb, shiftb, y, incy, mode);
vdLinearFrac ( n , a , b , scalea , shifta , scaleb , shiftb , y )
vdLinearFracI(n, a, inca, b, incb, scalea, shifta, scaleb, shiftb, y, incy);
vmdLinearFrac ( n , a , b , scalea , shifta , scaleb , shiftb , y , mode ) ;
vmdLinearFracI(n, a, inca, b, incb, scalea, shifta, scaleb, shiftb, y, incy, mode);
Include Files
mkl.h
Input Parameters
Name |
Type |
Description |
|---|---|---|
n |
const MKL_INT |
Specifies the number of elements to be calculated. |
a , b |
const _Float16* for vhLinearFrac , vmhLinearFrac const float* for vsLinearFrac , vmsLinearFrac const double* for vdLinearFrac , vmdLinearFrac |
Pointers to arrays that contain the input vectors a and b . |
inca , incb , incy |
const MKL_INT |
Specifies increments for the elements of a , b , and y . |
scalea , scaleb |
const _Float16 for vhLinearFrac , vmhLinearFrac const float for vsLinearFrac , vmsLinearFrac const double for vdLinearFrac , vmdLinearFrac |
Constant values for scaling multipliers of vectors a and b . |
shifta , shiftb |
const _Float16 for vhLinearFrac , vmhLinearFrac const float for vsLinearFrac , vmsLinearFrac const double for vdLinearFrac , vmdLinearFrac |
Constant values for shifting addends of vectors a and b . |
mode |
const MKL_INT64 |
Overrides global VM mode setting for this function call. See vmlSetMode (Sets a new mode for VM functions according to the mode parameter and stores the previous VM mode to oldmode.) for possible values and their description. |
Output Parameters
Name |
Type |
Description |
|---|---|---|
y |
_Float16* for vhLinearFrac , vmhLinearFrac float* for vsLinearFrac , vmsLinearFrac double* for vdLinearFrac , vmdLinearFrac |
Pointer to an array that contains the output vector y . |
Description
The v?LinearFrac function performs a linear fraction transformation of vector a by vector b with scalar parameters: scaling multipliers scalea , scaleb and shifting addends shifta , shiftb :
y[i]=(scalea·a[i]+shifta)/(scaleb·b[i]+shiftb) , i =1,2 … n
The v?LinearFrac function is implemented in the EP accuracy mode only, therefore no special values are defined for this function. If used in HA or LA mode, v?LinearFrac sets the VM Error Status to VML_STATUS_ACCURACYWARNING (see the Values of the VM Status table). Correctness is guaranteed within the threshold limitations defined for each input parameter (see the table below); otherwise, the behavior is unspecified.
Threshold Limitations on Input Parameters |
|---|
2^{E_{MIN}/2}≤ |scalea| ≤ 2^{(E_{MAX}-2)/2} |
2^{E_{MIN}/2}≤ |scaleb| ≤ 2^{(E_{MAX}-2)/2} |
|shifta| ≤ 2^{E_{MAX}-2} |
|shiftb| ≤ 2^{E_{MAX}-2} |
2^{E_{MIN}/2}≤a[i] ≤ 2^{(E_{MAX}-2)/2} |
2^{E_{MIN}/2}≤b[i] ≤ 2^{(E_{MAX}-2)/2} |
a[i] ≠ - (shifta/scalea)*(1-δ_{1}), |δ_{1}| ≤ 2^{1-(p-1)/2} |
b[i] ≠ - (shiftb/scaleb)*(1-δ_{2}), |δ_{2}| ≤ 2^{1-(p-1)/2} |
E_{MIN} and E_{MAX} are the minimum and maximum exponents and p is the number of significant bits (precision) for the corresponding data type according to the ANSI/IEEE Standard 754-2008 ([ IEEE754 ]):
for single precision E_{MIN} = -126, E_{MAX} = 127, p = 24
for double precision E_{MIN} = -1022, E_{MAX} = 1023, p = 53
The thresholds become less strict for common cases with scalea =0 and/or scaleb =0:
if scalea =0, there are no limitations for the values of a[i] and shifta .
if scaleb =0, there are no limitations for the values of b[i] and shiftb .
To use the v?linearfracv?LinearFrac to shift vector a by a scalar value, set scaleb to 0. Note that even if scaleb is 0, b must be declared.
#include <stdio.h>
#include "mkl_vml.h"
int main()
{
double a[10], *b;
double r[10];
double scalea = 1.0, scaleb = 0.0;
double shifta = -1.0, shiftb = 1.0;
MKL_INT i=0,n=10;
a[0]=-10000.0000;
a[1]=-7777.7777;
a[2]=-5555.5555;
a[3]=-3333.3333;
a[4]=-1111.1111;
a[5]=1111.1111;
a[6]=3333.3333;
a[7]=5555.5555;
a[8]=7777.7777;
a[9]=10000.0000;
vdLinearFrac( n, a, b, scalea, shifta, scaleb, shiftb, r );
for(i=0;i<10;i++) {
printf("%25.14f %25.14f\n",a[i],r[i]);
}
return 0;
}
To use the v?linearfracv?LinearFrac to compute shifta /( scaleb · b [ i ]+ shiftb ), set scalea to 0. Note that even if scalea is 0, a must be declared.