# vDSP

Perform basic arithmetic operations and common digital signal processing routines on large vectors.

## Overview

The vDSP framework contains a collection of highly optimized functions for digital signal processing and general purpose arithmetic on large arrays. On the digital signal processing side, for example, vDSP includes Fourier transform and biquadratic filtering operations. On the arithmetic side, for example, vDSP includes functions such as multiply-add and reduction functions such as sum, mean, and maximum.

The following sequence of images illustrates vDSP's capabilities. For example, you can use `vDSP_vtmerg(_:_:_:_:_:_:_:)`to combine two waveforms (at top) to produce a vector (at bottom) that you use to create a smooth transition between two signals.

The majority of vDSP operations are single-threaded and run on a single core. However, the following functions may be multithreaded depending on the size of the data they are operating on:

## Topics

### Fundamentals

Controlling vDSP Operations with Stride

Operate selectively on the elements of a vector at regular intervals.

Using vDSP for Vector-based Arithmetic

Increase the performance of common mathematical tasks with vDSP vector-vector and vector-scalar operations.

### Swift Overlay

`enum vDSP`

An enumeration that acts as a namespace for Swift overlays to vDSP.

vDSP Protocols

Protocols that support Swift implementations of vDSP operations.

### Vector Generation, Filling, and Clearing

Vector Generation

Populate vectors with ramps, values from lookup tables, and window functions.

Vector Clear and Fill Functions

Populate vectors with zeros or a scalar value.

### Vector Reduction

Vector Extrema Calculation

Calculate the minimum and maximum values in a vector.

Vector Average Calculation

Calculate the average value in a vector.

Vector Summation

Sum the values in a vector.

### Vector Geometry Functions

Vector-to-Vector Distance and Pythagorean Computation

Calculate distance and hypotenuse of vectors.

Dot Product Calculation

Calculate the scalar product of two vectors.

### Vector-Scalar Arithmetic

Basic Arithmetic Functions

Perform operations on scalar values and vectors.

### Vector-Vector Arithmetic

Real Basic Arithmetic

Perform elementwise operations on vectors of real values.

Complex Basic Arithmetic

Perform elementwise operations on vectors of complex values.

Integer Arithmetic

Perform elementwise operations on vectors of integer values.

### Data Types

`typealias vDSP_Length`

Used for numbers of elements in arrays and indices of elements in arrays. It is also used for the base-two logarithm of numbers of elements.

`typealias vDSP_Stride`

Used to hold differences between indices of elements, including the lengths of strides.

`struct DSPComplex`

Used to hold a complex value.

`struct DSPSplitComplex`

A structure that represents a single-precision complex number with the real and imaginary parts stored in separate arrays.

`struct DSPDoubleComplex`

Used to hold a double-precision complex value.

`struct DSPDoubleSplitComplex`

A structure that represents a double-precision complex number with the real and imaginary parts stored in separate arrays.

`struct vDSP.VectorizableDouble`

A structure that represents a double-precision real value for biquadratic filtering and discrete Fourier transforms.

`struct vDSP.VectorizableFloat`

A structure that represents a single-precision real value for biquadratic filtering and discrete Fourier transforms.

### Constants

vDSP Compile-Time Version Information

The version of vDSP (at compile time).

### Signal Processing Essentials

Controlling vDSP Operations with Stride

Operate selectively on the elements of a vector at regular intervals.

Use Linear Interpolation to Construct New Data Points

Fill the gaps in arrays of numerical data using linear interpolation.

Using vDSP for Vector-based Arithmetic

Increase the performance of common mathematical tasks with vDSP vector-vector and vector-scalar operations.

Resampling a Signal with Decimation

Reduce the sample rate of a signal, by specifying a decimation factor and applying a custom antialiasing filter.