| Framework | Accelerate/vecLib |
| Declared in | vDSP.h |
Describes the C API for the vecLib functions that operate on the elements of a single vector.
vDSP_vclip
vDSP_vclipD
vDSP_vclipc
vDSP_vclipcD
vDSP_viclip
vDSP_viclipD
vDSP_vlim
vDSP_vlimD
vDSP_vthr
vDSP_vthrD
vDSP_vthres
vDSP_vthresD
vDSP_vthrsc
vDSP_vthrscD
The contents of a submatrix are copied to another submatrix.
void vDSP_mmov (float * A, float * C, vDSP_Length NC, vDSP_Length NR, vDSP_Length TCA, vDSP_Length TCC);
Single-precision real input submatrix
Single-precision real output submatrix
Number of columns in A and C
Number of rows in A and C
Number of columns in the matrix of which A is a submatrix
Number of columns in the matrix of which C is a submatrix
This performs the operation
The matrices are assumed to be stored in row-major order. Thus elements A[i][j] and A[i][j+1] are adjacent. Elements A[i][j] and A[i+1][j] are TCA elements apart.
This function may be used to move a subarray beginning at any point in a larger embedding array by passing for A the address of the first element of the subarray. For example, to move a subarray starting at A[3][4], pass &A[3][4]. Similarly, the address of the first destination element is passed for C
NC may equal TCA, and it may equal TCC. To copy all of an array to all of another array, pass the number of rows in NR and the number of columns in NC, TCA, and TCC.
vDSP.hThe contents of a submatrix are copied to another submatrix.
void vDSP_mmovD (double * A, double * C, vDSP_Length NC, vDSP_Length NR, vDSP_Length TCA, vDSP_Length TCC);
Double-precision real input submatrix
Double-precision real output submatrix
Number of columns in A and C
Number of rows in A and C
Number of columns in the matrix of which A is a submatrix
Number of columns in the matrix of which C is a submatrix
This performs the operation
The matrices are assumed to be stored in row-major order. Thus elements A[i][j] and A[i][j+1] are adjacent. Elements A[i][j] and A[i+1][j] are TCA elements apart.
This function may be used to move a subarray beginning at any point in a larger embedding array by passing for A the address of the first element of the subarray. For example, to move a subarray starting at A[3][4], pass &A[3][4]. Similarly, the address of the first destination element is passed for C
NC may equal TCA, and it may equal TCC. To copy all of an array to all of another array, pass the number of rows in NR and the number of columns in NC, TCA, and TCC.
vDSP.h Find zero crossings; single precision.
void vDSP_nzcros (float * A, vDSP_Stride I, vDSP_Length B, vDSP_Length * C, vDSP_Length * D, vDSP_Length N);
Single-precision real input vector
Stride for A
Maximum number of crossings to find
Index of last crossing found
Total number of zero crossings found
Count of elements in A
This performs the operation

The "function" sign(x) above has the value -1 if the sign bit of x is 1 (x is negative or -0), and +1 if the sign bit is 0 (x is positive or +0).
Scans vector A to locate transitions from positive to negative values and from negative to positive values. The scan terminates when the number of crossings specified by B is found, or the end of the vector is reached. The zero-based index of the last crossing is returned in C. C is the actual array index, not the pre-stride index. If the zero crossing that B specifies is not found, zero is returned in C. The total number of zero crossings found is returned in D.
Note that a transition from -0 to +0 or from +0 to -0 is counted as a zero crossing.
vDSP.h Find zero crossings; double precision.
void vDSP_nzcrosD (double * A, vDSP_Stride I, vDSP_Length B, vDSP_Length * C, vDSP_Length * D, vDSP_Length N);
Double-precision real input vector
Stride for A
Maximum number of crossings to find
Index of last crossing found
Total number of zero crossings found
Count of elements in A
This performs the operation

The "function" sign(x) above has the value -1 if the sign bit of x is 1 (x is negative or -0), and +1 if the sign bit is 0 (x is positive or +0).
Scans vector A to locate transitions from positive to negative values and from negative to positive values. The scan terminates when the number of crossings specified by B is found, or the end of the vector is reached. The zero-based index of the last crossing is returned in C. C is the actual array index, not the pre-stride index. If the zero crossing that B specifies is not found, zero is returned in C. The total number of zero crossings found is returned in D.
Note that a transition from -0 to +0 or from +0 to -0 is counted as a zero crossing.
vDSP.h Rectangular to polar conversion; single precision.
void vDSP_polar (float * A, vDSP_Stride I, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Stride for A, must be even
Single-precision output vector
Stride for C, must be even
Number of ordered pairs processed
This performs the operation
Converts rectangular coordinates to polar coordinates. Cartesian (x,y) pairs are read from vector A. Polar (rho, theta) pairs, where rho is the radius and theta is the angle in the range [-pi, pi] are written to vector C. N specifies the number of coordinate pairs in A and C.
Coordinate pairs are adjacent elements in the array, regardless of stride; stride is the distance from one coordinate pair to the next.
This function performs the inverse operation of vDSP_rect, which converts polar to rectangular coordinates.
vDSP.h Rectangular to polar conversion; double precision.
void vDSP_polarD (double * A, vDSP_Stride I, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A, must be even
Double-precision output vector
Stride for C, must be even
Number of ordered pairs processed
This performs the operation
Converts rectangular coordinates to polar coordinates. Cartesian (x,y) pairs are read from vector A. Polar (rho, theta) pairs, where rho is the radius and theta is the angle in the range [-pi, pi] are written to vector C. N specifies the number of coordinate pairs in A and C.
Coordinate pairs are adjacent elements in the array, regardless of stride; stride is the distance from one coordinate pair to the next.
This function performs the inverse operation of vDSP_rectD, which converts polar to rectangular coordinates.
vDSP.h Polar to rectangular conversion; single precision.
void vDSP_rect (float * A, vDSP_Stride I, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Stride for A, must be even
Single-precision real output vector
Stride for C, must be even
Number of ordered pairs processed
This performs the operation
Converts polar coordinates to rectangular coordinates. Polar (rho, theta) pairs, where rho is the radius and theta is the angle in the range [-pi, pi] are read from vector A. Cartesian (x,y) pairs are written to vector C. N specifies the number of coordinate pairs in A and C.
Coordinate pairs are adjacent elements in the array, regardless of stride; stride is the distance from one coordinate pair to the next.
This function performs the inverse operation of vDSP_polar, which converts rectangular to polar coordinates.
vDSP.h Polar to rectangular conversion; double precision.
void vDSP_rectD (double * A, vDSP_Stride I, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A, must be even
Double-precision real output vector
Stride for C, must be even
Number of ordered pairs processed
This performs the operation
Converts polar coordinates to rectangular coordinates. Polar (rho, theta) pairs, where rho is the radius and theta is the angle in the range [-pi, pi] are read from vector A. Cartesian (x,y) pairs are written to vector C. N specifies the number of coordinate pairs in A and C.
Coordinate pairs are adjacent elements in the array, regardless of stride; stride is the distance from one coordinate pair to the next.
This function performs the inverse operation of vDSP_polarD, which converts rectangular to polar coordinates.
vDSP.h Vector absolute values; single precision.
void vDSP_vabs (float * A, vDSP_Stride I, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real output vector
Stride for C
Count
This performs the operation
Writes the absolute values of the elements of A into corresponding elements of C.
vDSP.h Vector absolute values; double precision.
void vDSP_vabsD (double * A, vDSP_Stride I, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real output vector
Stride for C
Count
This performs the operation
Writes the absolute values of the elements of A into corresponding elements of C.
vDSP.h Integer vector absolute values.
void vDSP_vabsi (int * A, vDSP_Stride I, int * C, vDSP_Stride K, vDSP_Length N);
Integer input vector
Stride for A
Integer output vector
Stride for C
Count
This performs the operation
Writes the absolute values of the elements of A into corresponding elements of C.
vDSP.h Vector linear average; single precision.
void vDSP_vavlin (float * A, vDSP_Stride I, float * B, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real input scalar
Single-precision real input-output vector
Stride for C
Count ; each vector must have at least N elements
This performs the operation

Recalculates the linear average of input-output vector C to include input vector A. Input scalar B specifies the number of vectors included in the current average.
vDSP.h Vector linear average; double precision.
void vDSP_vavlinD (double * A, vDSP_Stride I, double * B, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real input scalar
Double-precision real input-output vector
Stride for C
Count ; each vector must have at least N elements
This performs the operation

Recalculates the linear average of input-output vector C to include input vector A. Input scalar B specifies the number of vectors included in the current average.
vDSP.h Vector clip; single precision.
void vDSP_vclip (float * A, vDSP_Stride I, float * B, float * C, float * D, vDSP_Stride L, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real input scalar: low clipping threshold
Single-precision real input scalar: high clipping threshold
Single-precision real output vector
Stride for D
Count
This performs the operation

Elements of A are copied to D while clipping elements that are outside the interval [B, C] to the endpoints.
vDSP.h Vector clip and count; single precision.
void vDSP_vclipc (float * A, vDSP_Stride I, float * B, float * C, float * D, vDSP_Stride L, vDSP_Length N, vDSP_Length * NLOW, vDSP_Length * NHI);
Single-precision real input vector
Stride for A
Single-precision real input scalar: low clipping threshold
Single-precision real input scalar: high clipping threshold
Single-precision real output vector
Stride for D
Count of elements in A and D
Number of elements that were clipped to B
Number of elements that were clipped to C
This performs the operation

Elements of A are copied to D while clipping elements that are outside the interval [B, C] to the endpoints.
The count of elements clipped to B is returned in *NLOW, and the count of elements clipped to C is returned in *NHI
vDSP.h Vector clip and count; double precision.
void vDSP_vclipcD (double * A, vDSP_Stride I, double * B, double * C, double * D, vDSP_Stride L, vDSP_Length N, vDSP_Length * NLOW, vDSP_Length * NHI);
Double-precision real input vector
Stride for A
Double-precision real input scalar: low clipping threshold
Double-precision real input scalar: high clipping threshold
Double-precision real output vector
Stride for D
Count of elements in A and D
Number of elements that were clipped to B
Number of elements that were clipped to C
This performs the operation

Elements of A are copied to D while clipping elements that are outside the interval [B, C] to the endpoints.
The count of elements clipped to B is returned in *NLOW, and the count of elements clipped to C is returned in *NHI
vDSP.h Vector clip; double precision.
void vDSP_vclipD (double * A, vDSP_Stride I, double * B, double * C, double * D, vDSP_Stride L, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real input scalar: low clipping threshold
Double-precision real input scalar: high clipping threshold
Double-precision real output vector
Stride for D
Count
This performs the operation

Elements of A are copied to D while clipping elements that are outside the interval [B, C] to the endpoints.
vDSP.h Vector clear; single precision.
void vDSP_vclr (float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input-output vector
Stride for C
Count
All elements of vector C are set to zeros.
vDSP.h Vector clear; double precision.
void vDSP_vclrD (double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input-output vector
Stride for C
Count
All elements of vector C are set to zeros.
vDSP.h Vector compress; single precision.
void vDSP_vcmprs (float * A, vDSP_Stride I, float * B, vDSP_Stride J, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real input vector
Stride for B
Single-precision real output vector
Stride for C
Count
Performs the operation

Compresses vector A based on the nonzero values of gating vector B. For nonzero elements of B, corresponding elements of A are sequentially copied to output vector C.
vDSP.h Vector compress; double precision.
void vDSP_vcmprsD (double * A, vDSP_Stride I, double * B, vDSP_Stride J, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real input vector
Stride for B
Double-precision real output vector
Stride for C
Count
Performs the operation

Compresses vector A based on the nonzero values of gating vector B. For nonzero elements of B, corresponding elements of A are sequentially copied to output vector C.
vDSP.h Vector convert power or amplitude to decibels; single precision.
void vDSP_vdbcon (float * A, vDSP_Stride I, float * B, float * C, vDSP_Stride K, vDSP_Length N, unsigned int F);
Single-precision real input vector
Stride for A
Single-precision real input scalar: zero reference
Single-precision real output vector
Stride for C
Count
Power (0) or amplitude (1) flag
Performs the operation
Converts inputs from vector A to their decibel equivalents, calculated in terms of power or amplitude according to flag F. As a relative reference point, the value of input scalar B is considered to be zero decibels.
vDSP.h Vector convert power or amplitude to decibels; double precision.
void vDSP_vdbconD (double * A, vDSP_Stride I, double * B, double * C, vDSP_Stride K, vDSP_Length N, unsigned int F);
Double-precision real input vector
Stride for A
Double-precision real input scalar: zero reference
Double-precision real output vector
Stride for C
Count
Power (0) or amplitude (1) flag
Performs the operation
Converts inputs from vector A to their decibel equivalents, calculated in terms of power or amplitude according to flag F. As a relative reference point, the value of input scalar B is considered to be zero decibels.
vDSP.h Vector convert double-precision to single-precision.
void vDSP_vdpsp (double * A, vDSP_Stride I, float * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A
Single-precision real output vector
Stride for C
Count
This performs the operation
Creates single-precision vector C by converting double-precision inputs from vector A.
vDSP.hVector fill; single precision.
void vDSP_vfill (float * A, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input scalar
Single-precision real output vector
Stride for C
Count
Performs the operation
Sets each element of vector C to the value of A.
vDSP.hVector fill; double precision.
void vDSP_vfillD (double * A, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input scalar
Double-precision real output vector
Stride for C
Count
Performs the operation
Sets each element of vector C to the value of A.
vDSP.hInteger vector fill.
void vDSP_vfilli (int * A, int * C, vDSP_Stride K, vDSP_Length N);
Integer input scalar
Integer output vector
Stride for C
Count
Performs the operation
Sets each element of vector C to the value of A.
vDSP.h Vector truncate to fraction; single precision.
void vDSP_vfrac (float * A, vDSP_Stride I, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real output vector
Stride for C
Count
Performs the operation
The "function" truncate(x) is the integer farthest from 0 but not farther than x. Thus, for example, vDSP_vFrac(-3.25) produces the result -0.25.
Sets each element of vector C to the signed fractional part of the corresponding element of A.
vDSP.h Vector truncate to fraction; double precision.
void vDSP_vfracD (double * A, vDSP_Stride I, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real output vector
Stride for C
Count
Performs the operation
The "function" truncate(x) is the integer farthest from 0 but not farther than x. Thus, for example, vDSP_vFrac(-3.25) produces the result -0.25.
Sets each element of vector C to the signed fractional part of the corresponding element of A.
vDSP.h Vector gather; single precision.
void vDSP_vgathr (float * A, vDSP_Length * B, vDSP_Stride J, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Integer vector containing indices
Stride for B
Single-precision real output vector
Stride for C
Count
Performs the operation
Uses elements of vector B as indices to copy selected elements of vector A to sequential locations in vector C. Note that 1, not zero, is treated as the first location in the input vector when evaluating indices. This function can only be done out of place.
vDSP.h Vector gather, absolute pointers; single precision.
void vDSP_vgathra (float ** A, vDSP_Stride I, float * C, vDSP_Stride K, vDSP_Length N);
Pointer input vector
Stride for A
Single-precision real output vector
Stride for C
Count
Performs the operation
Uses elements of vector A as pointers to copy selected single-precision values from memory to sequential locations in vector C. This function can only be done out of place.
vDSP.h Vector gather, absolute pointers; double precision.
void vDSP_vgathraD (double ** A, vDSP_Stride I, double * C, vDSP_Stride K, vDSP_Length N);
Pointer input vector
Stride for A
Double-precision real output vector
Stride for C
Count
Performs the operation
Uses elements of vector A as pointers to copy selected double-precision values from memory to sequential locations in vector C. This function can only be done out of place.
vDSP.h Vector gather; double precision.
void vDSP_vgathrD (double * A, vDSP_Length * B, vDSP_Stride J, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Integer vector containing indices
Stride for B
Double-precision real output vector
Stride for C
Count
Performs the operation
Uses elements of vector B as indices to copy selected elements of vector A to sequential locations in vector C. Note that 1, not zero, is treated as the first location in the input vector when evaluating indices. This function can only be done out of place.
vDSP.h Vector tapered ramp; single precision.
void vDSP_vgen (float * A, float * B, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input scalar: base value
Single-precision real input scalar: end value
Single-precision real output vector
Stride for C
Count
Performs the operation
Creates ramped vector C with element zero equal to scalar A and element N-1 equal to scalar B. Output values between element zero and element N-1 are evenly spaced and increase or decrease monotonically.
vDSP.h Vector tapered ramp; double precision.
void vDSP_vgenD (double * A, double * B, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input scalar: base value
Double-precision real input scalar: end value
Double-precision real output vector
Stride for C
Count
Performs the operation
Creates ramped vector C with element zero equal to scalar A and element N-1 equal to scalar B. Output values between element zero and element N-1 are evenly spaced and increase or decrease monotonically.
vDSP.h Vector generate by extrapolation and interpolation; single precision.
void vDSP_vgenp (float * A, vDSP_Stride I, float * B, vDSP_Stride J, float * C, vDSP_Stride K, vDSP_Length N, vDSP_Length M);
Single-precision real input vector
Stride for A
Single-precision real input vector
Stride for B
Single-precision real output vector
Stride for C
Count for C
Count for A and B
Performs the operation

Generates vector C by extrapolation and linear interpolation from the ordered pairs (A,B) provided by corresponding elements in vectors A and B. Vector B provides index values and should increase monotonically. Vector A provides intensities, magnitudes, or some other measurable quantities, one value associated with each value of B. This function can only be done out of place.
Vectors A and B define a piecewise linear function, f(x):
In the interval [-infinity, trunc(B[0*J]], the function is the constant A[0*I].
In each interval (trunc(B[m*J]), trunc(B[(m+1)*J])], the function is the line passing through the two points (B[m*J], A[m*I]) and (B[(m+1)*J], A[(m+1)*I]). (This is for each integer m, 0 <= m < M-1.)
In the interval (B[(M-1)*J], infinity], the function is the constant A[(M-1)*I].
For 0 <= n < N, C[n*K] = f(n).
This function can only be done out of place.
Output values are generated for integral indices in the range zero through N - 1, deriving output values by interpolating and extrapolating from vectors A and B. For example, if vectors A and B define velocity and time pairs (v, t), vDSP_vgenp writes one velocity to vector C for every integral unit of time from zero to N - 1.
vDSP.h Vector generate by extrapolation and interpolation; double precision.
void vDSP_vgenpD (double * A, vDSP_Stride I, double * B, vDSP_Stride J, double * C, vDSP_Stride K, vDSP_Length N, vDSP_Length M);
Double-precision real input vector
Stride for A
Double-precision real input vector
Stride for B
Double-precision real output vector
Stride for C
Count for C
Count for A and B
Performs the operation

Generates vector C by extrapolation and linear interpolation from the ordered pairs (A,B) provided by corresponding elements in vectors A and B. Vector B provides index values and should increase monotonically. Vector A provides intensities, magnitudes, or some other measurable quantities, one value associated with each value of B. This function can only be done out of place.
Vectors A and B define a piecewise linear function, f(x):
In the interval [-infinity, trunc(B[0*J]], the function is the constant A[0*I].
In each interval (trunc(B[m*J]), trunc(B[(m+1)*J])], the function is the line passing through the two points (B[m*J], A[m*I]) and (B[(m+1)*J], A[(m+1)*I]). (This is for each integer m, 0 <= m < M-1.)
In the interval (B[(M-1)*J], infinity], the function is the constant A[(M-1)*I].
For 0 <= n < N, C[n*K] = f(n).
This function can only be done out of place.
Output values are generated for integral indices in the range zero through N - 1, deriving output values by interpolating and extrapolating from vectors A and B. For example, if vectors A and B define velocity and time pairs (v, t), vDSP_vgenp writes one velocity to vector C for every integral unit of time from zero to N - 1.
vDSP.h Vector inverted clip; single precision.
void vDSP_viclip (float * A, vDSP_Stride I, float * B, float * C, float * D, vDSP_Stride L, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real input scalar: lower threshold
Single-precision real input scalar: upper threshold
Single-precision real output vector
Stride for D
Count
Performs the operation

Performs an inverted clip of vector A using lower-threshold and upper-threshold input scalars B and C.
vDSP.h Vector inverted clip; double precision.
void vDSP_viclipD (double * A, vDSP_Stride I, double * B, double * C, double * D, vDSP_Stride L, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real input scalar: lower threshold
Double-precision real input scalar: upper threshold
Double-precision real output vector
Stride for D
Count
Performs the operation

Performs an inverted clip of vector A using lower-threshold and upper-threshold input scalars B and C.
vDSP.h Vector index; single precision.
void vDSP_vindex (float * A, float * B, vDSP_Stride J, float * C, vDSP_Stride K, vDSP_Length N);
Single-precision real input vector
Single-precision real input vector: indices
Stride for B
Single-precision real output vector
Stride for C
Count
Performs the operation
Uses vector B as zero-based subscripts to copy selected elements of vector A to vector C. Fractional parts of vector B are ignored.
vDSP.h Vector index; double precision.
void vDSP_vindexD (double * A, double * B, vDSP_Stride J, double * C, vDSP_Stride K, vDSP_Length N);
Double-precision real input vector
Double-precision real input vector: indices
Stride for B
Double-precision real output vector
Stride for C
Count
Performs the operation
Uses vector B as zero-based subscripts to copy selected elements of vector A to vector C. Fractional parts of vector B are ignored.
vDSP.h Vector test limit; single precision.
void vDSP_vlim (float * A, vDSP_Stride I, float * B, float * C, float * D, vDSP_Stride L, vDSP_Length N);
Single-precision real input vector
Stride for A
Single-precision real input scalar: limit
Single-precision real input scalar
Single-precision real output vector
Stride for D
Count
Compares values from vector A to limit scalar B. For inputs greater than or equal to B, scalar C is written to D . For inputs less than B, the negated value of scalar C is written to vector D.
vDSP.h Vector test limit; double precision.
void vDSP_vlimD (double * A, vDSP_Stride I, double * B, double * C, double * D, vDSP_Stride L, vDSP_Length N);
Double-precision real input vector
Stride for A
Double-precision real input scalar: limit
Double-precision real input scalar
Double-precision real output vector
Stride for D
Count
Compares values from vector A to limit scalar B. For inputs greater than or equal to B, scalar C is written to D . For inputs less than B, the negated value of scalar C is written to vector D.
vDSP.h Vector linear interpolation between neighboring elements; single precision.
void vDSP_vlint (float * A, float * B, vDSP_Stride J, float * C, vDSP_Stride K, vDSP_Length N, vDSP_Length M);
Single-precision real input vector
Single-precision real input vector: integer parts are indices into A and fractional parts are interpolation constants
Stride for B
Single-precision real output vector
Stride for C
Count for C
Length of A
Performs the operation

Generates vector C by interpolating between neighboring values of vector A as controlled by vector B. The integer portion of each element in B is the zero-based index of the first element of a pair of adjacent values in vector A.
The value of the corresponding element of C is