Developer Reference

  • 0.9
  • 09/09/2020
  • Public Content
Contents

v?LinearFrac

Performs linear fraction transformation of vectors
a
and
b
with scalar parameters.

Syntax

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 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 float
for
vsLinearFrac
,
vmsLinearFrac
const double
for
vdLinearFrac
,
vmdLinearFrac
Constant values for scaling multipliers of vectors
a
and
b
.
shifta
,
shiftb
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
for possible values and their description.
Output Parameters
Name
Type
Description
y
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?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?LinearFrac
to compute
shifta
/(
scaleb
·
b
[
i
]+
shiftb
), set
scalea
to 0. Note that even if
scalea
is 0,
a
must be declared.

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804