Developer Reference


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]); }
– current index,
– input index increment,
– output index increment.
– the number of elements to be computed (important:
is not the maximum array size).
So, when calling
vsExpI(n, a, inca, r, incr)
be sure that the input vector
is allocated at least for
1 + (
elements and the result vector
has a space for
1 + (
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:
for (i=0; i<n; i++) { r[- i*3] = exp (a[-i*2]); }
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:
for (i=0; i<n; i++) { r[i] = a[i] * b[0]; }
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
field in Function Naming Conventions). For more information on the indexing methods, see Vector Arguments in VM.

Product and Performance Information


Performance varies by use, configuration and other factors. Learn more at