Creates an FIR filter that can be used as a Wiener filter; single precision.


func vDSP_wiener(_ __L: vDSP_Length, _ __A: UnsafePointer<Float>, _ __C: UnsafePointer<Float>, _ __F: UnsafeMutablePointer<Float>, _ __P: UnsafeMutablePointer<Float>, _ __Flag: Int32, _ __Error: UnsafeMutablePointer<Int32>)



Desired FIR filter length.


Single-precision real input vector: autocorrelation of a given signal.


Single-precision real input vector: cross-correlation of signal and observation.


Single-precision real output vector: FIR filter.


Single-precision real output vector: performance index. See Discussion below.


Not currently used, pass zero.


Error flag.


Performs the following operation:

mathematical formula

to solve a set of single-channel normal equations described by:

 B[n] = C[0] * A[n] + C[1] * A[n-1] +, . . . ,+ C[N-1] * A[n-N+1]
 for n = {0, N-1}

where matrix A contains elements of the symmetric Toeplitz matrix shown below. This function can only be done out of place.

Note that A[-n] is considered to be equal to A[n].

vDSP_wiener solves this set of simultaneous equations using a recursive method described by Levinson. See Robinson, E.A., Multichannel Time Series Analysis with Digital Computer Programs. San Francisco: Holden-Day, 1967, pp. 43-46.

 |A[0]  A[1]  A[2] ... A[N-1] |    |C[0]  |   |B[0]  |
 |A[1]  A[0]  A[1] ... A[N-2] |    |C[1]  |   |B[1]  |
 |A[2]  A[1]  A[0] ... A[N-3] |  * |C[2]  | = |B[2]  |
 | ...   ...   ... ... ...    |    | ...  |   | ...  |
 |A[N-1]A[N-2]A[N-3] ... A[0] |    |C[N-1]|   |B[N-1]|

Typical methods for solving N equations in N unknowns have execution times proportional to N3, and memory requirements proportional to N2. By taking advantage of duplicate elements, the recursion method executes in a time proportional to N2 and requires memory proportional to N. The Wiener-Levinson algorithm recursively builds a solution by computing the m+1 matrix solution from the m matrix solution.

With successful completion,vDSP_wiener returns zero in error flag IERR. If vDSP_wiener fails, IERR indicates in which pass the failure occurred.

The solution, left in F, can be used as a Wiener filter.