Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

vDSP Single-Vector Operations Reference

Framework
Accelerate/vecLib
Declared in
vDSP.h

Overview

Describes the C API for the vecLib functions that operate on the elements of a single vector.

Functions by Task

Finding Absolute Values of Elements

Negating Values of Elements

Filling or Clearing Elements

Building a Vector With Generated Values

Squaring Element Values

Converting Between Polar and Rectangular Coordinates

Converting to Decibel Equivalents

Extracting Fractional Parts of Elements

Conjugating Complex Vectors

Squaring Magnitudes of Complex Elements

Calculating Phase Values of Complex Elements

Clipping, Limit, and Threshold Operations

Compressing Element Values

Gathering Elements of a Vector

Using Indices to Select Elements of a Vector

Reversing the Order of Elements

Copying Complex Vectors

Copying a Submatrix

Finding Zero Crossings

Calculating Linear Average of a Vector

Performing Linear Interpolation Between Neighboring Elements

Integrating a Vector

Sorting a Vector

Calculating Sliding-Window Sums

Converting Between Single and Double Precision

Functions

vDSP_mmov

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);

Parameters
A

Single-precision real input submatrix

C

Single-precision real output submatrix

NC

Number of columns in A and C

NR

Number of rows in A and C

TCA

Number of columns in the matrix of which A is a submatrix

TCC

Number of columns in the matrix of which C is a submatrix

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_mmovD

The 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);

Parameters
A

Double-precision real input submatrix

C

Double-precision real output submatrix

NC

Number of columns in A and C

NR

Number of rows in A and C

TCA

Number of columns in the matrix of which A is a submatrix

TCC

Number of columns in the matrix of which C is a submatrix

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_nzcros

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Maximum number of crossings to find

C

Index of last crossing found

D

Total number of zero crossings found

N

Count of elements in A

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_nzcrosD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Maximum number of crossings to find

C

Index of last crossing found

D

Total number of zero crossings found

N

Count of elements in A

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_polar

Rectangular to polar conversion; single precision.

   void  vDSP_polar (float * A,
   vDSP_Stride I,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

I

Stride for A, must be even

C

Single-precision output vector

K

Stride for C, must be even

N

Number of ordered pairs processed

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_polarD

Rectangular to polar conversion; double precision.

   void  vDSP_polarD (double * A,
   vDSP_Stride I,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A, must be even

C

Double-precision output vector

K

Stride for C, must be even

N

Number of ordered pairs processed

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_rect

Polar to rectangular conversion; single precision.

   void  vDSP_rect (float * A,
   vDSP_Stride I,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

I

Stride for A, must be even

C

Single-precision real output vector

K

Stride for C, must be even

N

Number of ordered pairs processed

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_rectD

Polar to rectangular conversion; double precision.

   void  vDSP_rectD (double * A,
   vDSP_Stride I,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A, must be even

C

Double-precision real output vector

K

Stride for C, must be even

N

Number of ordered pairs processed

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vabs

Vector absolute values; single precision.

   void  vDSP_vabs (float * A,
   vDSP_Stride I,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

I

Stride for A

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

This performs the operation


mathematical formula

Writes the absolute values of the elements of A into corresponding elements of C.

Availability
Declared In
vDSP.h

vDSP_vabsD

Vector absolute values; double precision.

   void  vDSP_vabsD (double * A,
   vDSP_Stride I,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

This performs the operation


mathematical formula

Writes the absolute values of the elements of A into corresponding elements of C.

Availability
Declared In
vDSP.h

vDSP_vabsi

Integer vector absolute values.

   void  vDSP_vabsi (int * A,
   vDSP_Stride I,
   int * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Integer input vector

I

Stride for A

C

Integer output vector

K

Stride for C

N

Count

Discussion

This performs the operation


mathematical formula

Writes the absolute values of the elements of A into corresponding elements of C.

Availability
Declared In
vDSP.h

vDSP_vavlin

Vector linear average; single precision.

   void  vDSP_vavlin (float * A,
   vDSP_Stride I,
   float * B,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input scalar

C

Single-precision real input-output vector

K

Stride for C

N

Count ; each vector must have at least N elements

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vavlinD

Vector linear average; double precision.

   void  vDSP_vavlinD (double * A,
   vDSP_Stride I,
   double * B,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input scalar

C

Double-precision real input-output vector

K

Stride for C

N

Count ; each vector must have at least N elements

Discussion

This performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vclip

Vector clip; single precision.

   void  vDSP_vclip (float * A,
   vDSP_Stride I,
   float * B,
   float * C,
   float * D,
   vDSP_Stride L,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input scalar: low clipping threshold

C

Single-precision real input scalar: high clipping threshold

D

Single-precision real output vector

L

Stride for D

N

Count

Discussion

This performs the operation


mathematical formula

Elements of A are copied to D while clipping elements that are outside the interval [B, C] to the endpoints.

Availability
Declared In
vDSP.h

vDSP_vclipc

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input scalar: low clipping threshold

C

Single-precision real input scalar: high clipping threshold

D

Single-precision real output vector

L

Stride for D

N

Count of elements in A and D

NLOW

Number of elements that were clipped to B

NHI

Number of elements that were clipped to C

Discussion

This performs the operation


mathematical formula

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

Availability
Declared In
vDSP.h

vDSP_vclipcD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input scalar: low clipping threshold

C

Double-precision real input scalar: high clipping threshold

D

Double-precision real output vector

L

Stride for D

N

Count of elements in A and D

NLOW

Number of elements that were clipped to B

NHI

Number of elements that were clipped to C

Discussion

This performs the operation


mathematical formula

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

Availability
Declared In
vDSP.h

vDSP_vclipD

Vector clip; double precision.

   void  vDSP_vclipD (double * A,
   vDSP_Stride I,
   double * B,
   double * C,
   double * D,
   vDSP_Stride L,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input scalar: low clipping threshold

C

Double-precision real input scalar: high clipping threshold

D

Double-precision real output vector

L

Stride for D

N

Count

Discussion

This performs the operation


mathematical formula

Elements of A are copied to D while clipping elements that are outside the interval [B, C] to the endpoints.

Availability
Declared In
vDSP.h

vDSP_vclr

Vector clear; single precision.

   void  vDSP_vclr (float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
C

Single-precision real input-output vector

K

Stride for C

N

Count

Discussion

All elements of vector C are set to zeros.

Availability
Declared In
vDSP.h

vDSP_vclrD

Vector clear; double precision.

   void  vDSP_vclrD (double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
C

Double-precision real input-output vector

K

Stride for C

N

Count

Discussion

All elements of vector C are set to zeros.

Availability
Declared In
vDSP.h

vDSP_vcmprs

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input vector

J

Stride for B

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vcmprsD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input vector

J

Stride for B

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vdbcon

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input scalar: zero reference

C

Single-precision real output vector

K

Stride for C

N

Count

F

Power (0) or amplitude (1) flag

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vdbconD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input scalar: zero reference

C

Double-precision real output vector

K

Stride for C

N

Count

F

Power (0) or amplitude (1) flag

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vdpsp

Vector convert double-precision to single-precision.

   void  vDSP_vdpsp (double * A,
   vDSP_Stride I,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

This performs the operation


mathematical formula

Creates single-precision vector C by converting double-precision inputs from vector A.

Availability
Declared In
vDSP.h

vDSP_vfill

Vector fill; single precision.

   void
   vDSP_vfill (float * A,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input scalar

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

Sets each element of vector C to the value of A.

Availability
Declared In
vDSP.h

vDSP_vfillD

Vector fill; double precision.

   void
   vDSP_vfillD (double * A,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input scalar

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

Sets each element of vector C to the value of A.

Availability
Declared In
vDSP.h

vDSP_vfilli

Integer vector fill.

   void
   vDSP_vfilli (int * A,
   int * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Integer input scalar

C

Integer output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

Sets each element of vector C to the value of A.

Availability
Declared In
vDSP.h

vDSP_vfrac

Vector truncate to fraction; single precision.

   void  vDSP_vfrac (float * A,
   vDSP_Stride I,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

I

Stride for A

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vfracD

Vector truncate to fraction; double precision.

   void  vDSP_vfracD (double * A,
   vDSP_Stride I,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

I

Stride for A

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgathr

Vector gather; single precision.

   void  vDSP_vgathr (float * A,
   vDSP_Length * B,
   vDSP_Stride J,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

B

Integer vector containing indices

J

Stride for B

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgathra

Vector gather, absolute pointers; single precision.

   void  vDSP_vgathra (float ** A,
   vDSP_Stride I,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Pointer input vector

I

Stride for A

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgathraD

Vector gather, absolute pointers; double precision.

   void  vDSP_vgathraD (double ** A,
   vDSP_Stride I,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Pointer input vector

I

Stride for A

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgathrD

Vector gather; double precision.

   void  vDSP_vgathrD (double * A,
   vDSP_Length * B,
   vDSP_Stride J,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

B

Integer vector containing indices

J

Stride for B

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgen

Vector tapered ramp; single precision.

   void  vDSP_vgen (float * A,
   float * B,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input scalar: base value

B

Single-precision real input scalar: end value

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgenD

Vector tapered ramp; double precision.

   void  vDSP_vgenD (double * A,
   double * B,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input scalar: base value

B

Double-precision real input scalar: end value

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

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.

Availability
Declared In
vDSP.h

vDSP_vgenp

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input vector

J

Stride for B

C

Single-precision real output vector

K

Stride for C

N

Count for C

M

Count for A and B

Discussion

Performs the operation


mathematical formula

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):

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.

Availability
Declared In
vDSP.h

vDSP_vgenpD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input vector

J

Stride for B

C

Double-precision real output vector

K

Stride for C

N

Count for C

M

Count for A and B

Discussion

Performs the operation


mathematical formula

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):

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.

Availability
Declared In
vDSP.h

vDSP_viclip

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input scalar: lower threshold

C

Single-precision real input scalar: upper threshold

D

Single-precision real output vector

L

Stride for D

N

Count

Discussion

Performs the operation


mathematical formula

Performs an inverted clip of vector A using lower-threshold and upper-threshold input scalars B and C.

Availability
Declared In
vDSP.h

vDSP_viclipD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input scalar: lower threshold

C

Double-precision real input scalar: upper threshold

D

Double-precision real output vector

L

Stride for D

N

Count

Discussion

Performs the operation


mathematical formula

Performs an inverted clip of vector A using lower-threshold and upper-threshold input scalars B and C.

Availability
Declared In
vDSP.h

vDSP_vindex

Vector index; single precision.

   void  vDSP_vindex (float * A,
   float * B,
   vDSP_Stride J,
   float * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Single-precision real input vector

B

Single-precision real input vector: indices

J

Stride for B

C

Single-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

Uses vector B as zero-based subscripts to copy selected elements of vector A to vector C. Fractional parts of vector B are ignored.

Availability
Declared In
vDSP.h

vDSP_vindexD

Vector index; double precision.

   void  vDSP_vindexD (double * A,
   double * B,
   vDSP_Stride J,
   double * C,
   vDSP_Stride K,
   vDSP_Length N);

Parameters
A

Double-precision real input vector

B

Double-precision real input vector: indices

J

Stride for B

C

Double-precision real output vector

K

Stride for C

N

Count

Discussion

Performs the operation


mathematical formula

Uses vector B as zero-based subscripts to copy selected elements of vector A to vector C. Fractional parts of vector B are ignored.

Availability
Declared In
vDSP.h

vDSP_vlim

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);

Parameters
A

Single-precision real input vector

I

Stride for A

B

Single-precision real input scalar: limit

C

Single-precision real input scalar

D

Single-precision real output vector

L

Stride for D

N

Count

Discussion

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.

Availability
Declared In
vDSP.h

vDSP_vlimD

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);

Parameters
A

Double-precision real input vector

I

Stride for A

B

Double-precision real input scalar: limit

C

Double-precision real input scalar

D

Double-precision real output vector

L

Stride for D

N

Count

Discussion

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.

Availability
Declared In
vDSP.h

vDSP_vlint

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);

Parameters
A

Single-precision real input vector

B

Single-precision real input vector: integer parts are indices into A and fractional parts are interpolation constants

J

Stride for B

C

Single-precision real output vector

K

Stride for C

N

Count for C

M

Length of A

Discussion

Performs the operation


mathematical formula

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