Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 12/16/2022
Public

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

Document Table of Contents

Vector Indexing Methods

Classic VM mathematical functions work with unit stride. Strided VM mathematical functions (names with “I” suffix) work with arbitrary integer increments. Increments may be positive, negative or equal to zero. For example:

VSEXPI (n, a, inca, r, incr)

is equivalent to:

for (i=0; i<n; i++)
{
    r[i * incr] = exp (a[i * inca]);
}
do i=1, n
    r((i-1)*incr+1) = EXP (a((i-1)*inca+1))
end do

where

i – current index,

inca – input index increment,

incr – output index increment.

n – the number of elements to be computed (important: n is not the maximum array size).

So, when calling VSEXPI(n, a, inca, r, incr) be sure that the input vector a is allocated at least for 1 + (n-1)*inca elements and the result vector r has a space for 1 + (n-1)*incr elements.

NOTE:
The order of computations is not guaranteed and no array bounds-checking is performed; therefore, the results for overlapped and in-place arrays are not generally deterministic for increments other than 1.

For output index increment, equal to 0, the result is not deterministic and generally nonsensical.

Use negative increments to step from base pointers in reverse order.

For example:

VSEXPI (n, a, -2, r, -3)

is equivalent to:

do i=1, n
    r((i-1)*(-3)+1)  = EXP (a((i-1)*(-2)+1));
end do
NOTE:
Pass pointers to the desired ending array element in memory as an argument for negative strides.

For example:

VSEXPI (n, a, 2, r(1000:), -3)

Use a zero increment for one fixed argument rather than an array.

For example:

VSMULI (n, a, 1, b, 0, r, 1)

is equivalent to:

do i=1, n
    r(i) = a(i) * b(1)
end do

VM Pack/Unpack functions use the following indexing methods to do this task:

  • positive increment

  • index vector

  • mask vector

The indexing method used in a particular function is indicated by the indexing modifier (see the description of the <mod> field in Function Naming Conventions). For more information on the indexing methods, see Vector Arguments in VM.

Related information