1 /*
2 
3     DSP operations, header
4     Copyright (C) 1998-2005 Jussi Laako
5 
6     This program is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10 
11     This program is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15 
16     You should have received a copy of the GNU General Public License
17     along with this program; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 
20 */
21 
22 
23 #ifdef USE_INTEL_MATH
24     #include <mathimf.h>
25 #else
26     #include <math.h>
27 #endif
28 #include <float.h>
29 
30 #include <Alloc.hh>
31 
32 #include "dsp/dsptypes.h"
33 #include "dsp/DSPConfig.hh"
34 #include "dsp/Transform4.hh"
35 #include "dsp/Transform8.hh"
36 #include "dsp/TransformS.hh"
37 
38 #ifdef DSP_USE_FFTW
39     #include <fftw3.h>
40 #endif
41 
42 
43 #ifndef DSPOP_HH
44     #define DSPOP_HH
45 
46     // To help compilers common subexpression elimination optimization
47     #ifdef __GNUG__
48         #define CONSTFUNC       __const__
49     #else
50         #define CONSTFUNC
51     #endif
52 
53     // Enable/disable function inlining
54     #ifndef __INTEL_COMPILER
55         #define INLINE          inline
56     #else
57         #define INLINE
58     #endif
59 
60     // function definitions for C-libraries lacking ISO C 9x standard
61     #if (defined(__BCPLUSPLUS__) || defined(SOLARIS) || defined(OSX))
62         #if (!defined(OSX))
63             #define isgreater(x, y) (x > y)
64             #define isless(x, y)    (x < y)
65         #endif
66         #define fmax(x, y)      ((x >= y) ? x : y)
67         #define fmin(x, y)      ((x <= y) ? x : y)
68         #define fmaxf(x, y)     fmax(x, y)
69         #define fminf(x, y)     fmin(x, y)
70         #define fma(x, y, z)    (z + x * y)
71         #define fmaf(x, y, z)   fma(x, y, z)
72         #define fabsf(x)        fabs(x)
73         #define powf(x, y)      pow(x, y)
74         #define sqrtf(x)        sqrt(x)
75         #define expf(x)         exp(x)
76         #define logf(x)         log(x)
77         #define log10f(x)       log10(x)
78         #define sinf(x)         sin(x)
79         #define sinhf(x)        sinh(x)
80         #define cosf(x)         cos(x)
81         #define coshf(x)        cosh(x)
82         #define atanf(x)        atan(x)
83         #define atan2f(x, y)    atan2(x, y)
84         #define acosf(x)        acos(x)
85         #define acosh(x)        (log(x + sqrt(x * x - 1)))
86         #define acoshf(x)       (logf(x + sqrtf(x * x - 1)))
87         #define hypotf(x, y)    hypot(x, y)
88     #endif
89 
90     // Microsoft VisualC++ partially conforms with ISO 9x standard
91     #ifdef _MSC_VER
92         #define fmax(x, y)      ((x >= y) ? x : y)
93         #define fmin(x, y)      ((x <= y) ? x : y)
94         #define fmaxf(x, y)     fmax(x, y)
95         #define fminf(x, y)     fmin(x, y)
96         #define fma(x, y, z)    (z + x * y)
97         #define fmaf(x, y, z)   fma(x, y, z)
98         #define acosh(x)        (log(x + sqrt(x * x - 1)))
99         #define acoshf(x)       (logf(x + sqrtf(x * x - 1)))
100         #define hypotf(x, y)    hypot(x, y)
101         #define isgreater(x, y) (x > y)
102         #define isless(x, y)    (x < y)
103     #endif
104 
105     // Intel C++ partially conforms with ISO 9x standard
106     #ifdef __INTEL_COMPILER
107         #undef isgreater
108         #undef isless
109         #define isgreater(x, y) (x > y)
110         #define isless(x, y)    (x < y)
111     #endif
112 
113     // Maximum iterations for modified zero order Bessel function of first kind
114     #define DSP_MAXBESSEL       32L
115 
116     // Filename for FFTW wisdom
117     #define DSP_WISDOM_FILE     "fftw.wisdom"
118 
119 
120     /**
121         Class specialization to support automatic typecasts to cartesian/polar
122         datatypes.
123     */
124     class clDSPAlloc : public clAlloc
125     {
126         public:
clDSPAlloc()127             clDSPAlloc () {}
clDSPAlloc(const clDSPAlloc & CopySrc)128             clDSPAlloc (const clDSPAlloc &CopySrc) : clAlloc(CopySrc) {}
clDSPAlloc(long lAllocSize)129             clDSPAlloc (long lAllocSize) : clAlloc(lAllocSize) {}
operator stSCplx*()130             operator stSCplx *()
131                 { return ((stpSCplx) vpPtr); }
operator stDCplx*()132             operator stDCplx *()
133                 { return ((stpDCplx) vpPtr); }
operator stSPolar*()134             operator stSPolar *()
135                 { return ((stpSPolar) vpPtr); }
operator stDPolar*()136             operator stDPolar *()
137                 { return ((stpDPolar) vpPtr); }
138             #if defined(DSP_USE_FFTW)
operator fftwf_complex*()139             operator fftwf_complex *()
140                 { return ((fftwf_complex *) vpPtr); }
operator fftw_complex*()141             operator fftw_complex *()
142                 { return ((fftw_complex *) vpPtr); }
143             #endif
144     };
145 
146     /**
147         Class of DSP operations
148     */
149     class clDSPOp
150     {
151             long lPrevSrcCount;
152             long lPrevDestCount;
153             float fPI;
154             double dPI;
155             // --- Dynamically allocated arrays
156             // FIR
157             int iFIRDlyIdx;
158             long lFIRLength;
159             clDSPAlloc FIRCoeff;
160             clDSPAlloc FIRBuf;
161             clDSPAlloc FIRWork;
162             // IIR
163             float fpIIR_C[5];
164             float fpIIR_X[3];
165             float fpIIR_Y[2];
166             double dpIIR_C[5];
167             double dpIIR_X[3];
168             double dpIIR_Y[2];
169             // FFT (and other transforms)
170             bool bFFTInitialized;
171             bool bRealTransform;
172             long lFFTLength;
173             float fFFTScale;
174             double dFFTScale;
175             long *lpSBitRevWork;
176             long *lpDBitRevWork;
177             float *fpCosSinTable;
178             double *dpCosSinTable;
179             void *vpSTfrm;
180             void *vpDTfrm;
181             clDSPAlloc SBitRevWork;
182             clDSPAlloc DBitRevWork;
183             clDSPAlloc SCosSinTable;
184             clDSPAlloc DCosSinTable;
185             clDSPAlloc FFTBuf;
186             #if defined(DSP_USE_FFTW)
187             fftwf_plan fftwpSPlan;
188             fftwf_plan fftwpSIPlan;
189             fftw_plan fftwpDPlan;
190             fftw_plan fftwpDIPlan;
191             #endif
192             #if defined(DSP_USE_RADIX4)
193             clTransform4 Tfrm;
194             #elif defined(DSP_USE_RADIX8)
195             clTransform8 Tfrm;
196             #else  // Split-radix
197             clTransformS Tfrm;
198             #endif
199         protected:
200             /**
201                 Cartesian to polar conversion.
202 
203                 \f[V=\sqrt{\Re^2+\Im^2}\f]
204                 \f[\varphi=\arctan{\left(\frac{\Im}{\Re}\right)}\f]
205 
206                 \param Magn Magnitude
207                 \param Phase Phase
208                 \param Real Real
209                 \param Imag Imaginary
210             */
211             static void Cart2Polar (float *, float *, float, float);
212             /// \overload
213             static void Cart2Polar (double *, double *, double, double);
214             /**
215                 \overload
216                 \param Magn Magnitude
217                 \param Phase Phase
218                 \param Cplx Cartesian
219             */
220             static void Cart2Polar (float *, float *, const stpSCplx);
221             /// \overload
222             static void Cart2Polar (double *, double *, const stpDCplx);
223             /**
224                 \overload
225                 \param Polar Polar
226                 \param Cplx Cartesian
227             */
228             static void Cart2Polar (stpSPolar, const stpSCplx);
229             /// \overload
230             static void Cart2Polar (stpDPolar, const stpDCplx);
231             /**
232                 \overload
233                 \param Coord Polar & Cartesian
234             */
235             static void Cart2Polar (utpSCoord);
236             /// \overload
237             static void Cart2Polar (utpDCoord);
238             /**
239                 Polar to cartesian conversion.
240 
241                 \f[\Re = V\cos(\varphi)\f]
242                 \f[\Im = V\sin(\varphi)\f]
243 
244                 \note See Cart2Polar for details
245             */
246             static void Polar2Cart (float *, float *, float, float);
247             /// \overload
248             static void Polar2Cart (double *, double *, double, double);
249             /// \overload
250             static void Polar2Cart (stpSCplx, float, float);
251             /// \overload
252             static void Polar2Cart (stpDCplx, double, double);
253             /// \overload
254             static void Polar2Cart (stpSCplx, const stpSPolar);
255             /// \overload
256             static void Polar2Cart (stpDCplx, const stpDPolar);
257             /// \overload
258             static void Polar2Cart (utpSCoord);
259             /// \overload
260             static void Polar2Cart (utpDCoord);
261             /**
262                 Complex addition
263 
264                 \f[(z_{r},z_{i})=(x_{r}+y_{r},x_{i}+y_{i})\f]
265 
266                 \param CplxDest Source & destination
267                 \param CplxSrc Source
268             */
269             static void CplxAdd (stpSCplx, const stpSCplx);
270             /// \overload
271             static void CplxAdd (stpDCplx, const stpDCplx);
272             /**
273                 \overload
274                 \param CplxDest Destination
275                 \param CplxSrc1 Source 1
276                 \param CplxSrc2 Source 2
277             */
278             static void CplxAdd (stpSCplx, const stpSCplx, const stpSCplx);
279             /// \overload
280             static void CplxAdd (stpDCplx, const stpDCplx, const stpDCplx);
281             /**
282                 Complex subtraction
283 
284                 \f[(z_{r},z_{i})=(x_{r}-y_{r},x_{i}-y_{i})\f]
285 
286                 \param CplxDest Source & destination
287                 \param CplxSrc Source
288             */
289             static void CplxSub (stpSCplx, const stpSCplx);
290             /// \overload
291             static void CplxSub (stpDCplx, const stpDCplx);
292             /**
293                 \overload
294                 \param CplxDest Destination
295                 \param CplxSrc1 Source 1
296                 \param CplxSrc2 Source 2
297             */
298             static void CplxSub (stpSCplx, const stpSCplx, const stpSCplx);
299             /// \overload
300             static void CplxSub (stpDCplx, const stpDCplx, const stpDCplx);
301             /**
302                 Complex multiply with real value
303 
304                 \f[(z_r,z_i)=(x_{r}y,x_{i}y)\f]
305 
306                 \param CplxDest Source & destination
307                 \param Src Source
308             */
309             static void CplxMul (stpSCplx, float);
310             /// \overload
311             static void CplxMul (stpDCplx, double);
312             /**
313                 Complex multiply
314 
315                 \f[\Re_{z}=\Re_{x}\Re_{y}-\Im_{x}\Im_{y}\f]
316                 \f[\Im_{z}=\Re_{x}\Im_{y}+\Re_{y}\Im_{x}\f]
317 
318                 \param CplxDest Source & destination
319                 \param CplxSrc Source
320             */
321             static void CplxMul (stpSCplx, const stpSCplx);
322             /// \overload
323             static void CplxMul (stpDCplx, const stpDCplx);
324             /**
325                 \overload
326                 \param CplxDest Destination
327                 \param CplxSrc Source 1
328                 \param CplxSrc Source 2
329             */
330             static void CplxMul (stpSCplx, const stpSCplx, const stpSCplx);
331             /// \overload
332             static void CplxMul (stpDCplx, const stpDCplx, const stpDCplx);
333             /**
334                 Complex multiply with complex conjugate
335 
336                 \f[\Re_{z}=\Re_{x}\Re_{y}-\Im_{x}(-\Im_{y})\f]
337                 \f[\Im_{z}=\Re_{x}(-\Im_{y})+\Re_{y}\Im_{x}\f]
338 
339                 \param CplxDest Source & destination
340                 \param CplxSrc Source
341             */
342             static void CplxMulC (stpSCplx, const stpSCplx);
343             /// \overload
344             static void CplxMulC (stpDCplx, const stpDCplx);
345             /**
346                 \overload
347                 \param CplxDest Destination
348                 \param CplxSrc1 Source 1
349                 \param CplxSrc2 Source 2
350             */
351             static void CplxMulC (stpSCplx, const stpSCplx, const stpSCplx);
352             /// \overload
353             static void CplxMulC (stpDCplx, const stpDCplx, const stpDCplx);
354             /**
355                 Complex division
356 
357                 \f[\Re_{z}=\frac{\Re_{x}\Re_{y}+\Im_{x}\Im_{y}}{\Re_{y}^2+\Im_{y}^2}\f]
358                 \f[\Im_{z}=\frac{\Im_{x}\Re_{y}-\Re_{x}\Im_{y}}{\Re_{y}^2+\Im_{y}^2}\f]
359 
360                 \param CplxDest Source & destination
361                 \param CplxSrc Source
362             */
363             static void CplxDiv (stpSCplx, const stpSCplx);
364             /// \overload
365             static void CplxDiv (stpDCplx, const stpDCplx);
366             /**
367                 \overload
368                 \param CplxDest Destination
369                 \param CplxSrc Source 1
370                 \param CplxSrc Source 2
371             */
372             static void CplxDiv (stpSCplx, const stpSCplx, const stpSCplx);
373             /// \overload
374             static void CplxDiv (stpDCplx, const stpDCplx, const stpDCplx);
375             // In-place is allowed for following
376             /**
377                 Complex exp function (e raised to y)
378 
379                 \f[\Re_{z}=\exp(\Re_{y})\cos(\Im_{y})\f]
380                 \f[\Im_{z}=\exp(\Re_{y})\sin(\Im_{y})\f]
381 
382                 \param CplxDest Destination
383                 \param CplxSrc Source
384             */
385             static void CplxExp (stpSCplx, const stpSCplx);
386             static void CplxExp (stpDCplx, const stpDCplx);
387             /**
388                 Complex natural logarithm
389 
390                 \f[\Re_{z}=\ln(|y|)\f]
391                 \f[\Im_{z}=\arg(y)\f]
392             */
393             static void CplxLog (stpSCplx, const stpSCplx);
394             static void CplxLog (stpDCplx, const stpDCplx);
395             /**
396                 Complex 10-base logarithm
397 
398                 \f[\Re_{z}=\log(|y|)\f]
399                 \f[\Im_{z}=\arg(y)\f]
400             */
401             static void CplxLog10 (stpSCplx, const stpSCplx);
402             static void CplxLog10 (stpDCplx, const stpDCplx);
403             /**
404                 Complex x raised to y
405 
406                 \f[z=\exp(\ln(x)y)\f]
407             */
408             static void CplxPow (stpSCplx, const stpSCplx, const stpSCplx);
409             static void CplxPow (stpDCplx, const stpDCplx, const stpDCplx);
410             /**
411                 Complex root y of x
412 
413                 \f[z=x^{\frac{1}{y}}\f]
414             */
415             static void CplxRoot (stpSCplx, const stpSCplx, const stpSCplx);
416             static void CplxRoot (stpDCplx, const stpDCplx, const stpDCplx);
CplxConj(stpSCplx spCplx)417             static void CplxConj (stpSCplx spCplx)
418                 { spCplx->I = -(spCplx->I); }
CplxConj(stpDCplx spCplx)419             static void CplxConj (stpDCplx spCplx)
420                 { spCplx->I = -(spCplx->I); }
421             static void CplxConj (stpSCplx, const stpSCplx);
422             static void CplxConj (stpDCplx, const stpDCplx);
423             /**
424                 Return multiple of n
425 
426                 \f[!n\f]
427 
428                 \param Value Value of n
429             */
430             static double Multiple (long);
431             /**
432                 Zero-order modified Bessel function of the first kind.
433 
434                 \f[I_{0}(x)=\sum_{k=0}^{K}\left[\frac{(x/2)^{k}}{k!}\right]^{2}\f]
435 
436                 \param Value Value of x
437             */
438             static float ModZeroBessel (float);
439             /// \overload
440             static double ModZeroBessel (double);
441             /**
442                 nth-order Chebyshev polynomial
443 
444                 \f[T_{n}(x)=\left\{\begin{array}{l}\cos(n\cos^{-1}x), |x|\leq{1}\\
445                 \cosh(n\cosh^{-1}x), |x|>1\end{array}\right.\f]
446 
447                 \param Order Order of polynomial
448                 \param Value Value of x
449             */
450             static float ChebyshevPolynom (float, float);
451             static double ChebyshevPolynom (double, double);
452         public:
453             clDSPOp();
454             virtual ~clDSPOp();
455             /**
456                 Round floatingpoint number to integer
457             */
458             static signed long Round (float);
459             static signed long Round (double);
460             /**
461                 Add single value to vector
462 
463                 \f[x(i)=x(i)+y, 0\leq{i}\leq{N-1}\f]
464 
465                 \param Dest Source & destination, x()
466                 \param Src Source, y
467                 \param Count Vector length, N
468             */
469             static void Add (float *, float, long);
470             /// \overload
471             static void Add (double *, double, long);
472             /// \overload
473             static void Add (stpSCplx, stSCplx, long);
474             /// \overload
475             static void Add (stpDCplx, stDCplx, long);
476             /**
477                 Add two vectors
478 
479                 \f[x(i)=x(i)+y(i), 0\leq{i}\leq{N-1}\f]
480 
481                 \param Dest Source & destination, x()
482                 \param Src Source, y()
483                 \param Count Vector length, N
484             */
485             static void Add (float *, const float *, long);
486             /// \overload
487             static void Add (double *, const double *, long);
488             /// \overload
489             static void Add (stpSCplx, const stpSCplx, long);
490             /// \overload
491             static void Add (stpDCplx, const stpDCplx, long);
492             /**
493                 Add two vectors and return result in third
494 
495                 \f[z(i)=x(i)+y(i), 0\leq{i}\leq{N-1}\f]
496 
497                 \param Dest Destination, z()
498                 \param Src1 Source 1, x()
499                 \param Src2 Source 2, y()
500                 \param Count Vector length, N
501             */
502             static void Add (float *, const float *, const float *, long);
503             /// \overload
504             static void Add (double *, const double *, const double *, long);
505             /// \overload
506             static void Add (stpSCplx, const stpSCplx, const stpSCplx, long);
507             /// \overload
508             static void Add (stpDCplx, const stpDCplx, const stpDCplx, long);
509             /**
510                 Subtract single value from vector
511 
512                 \f[x(i)=x(i)-y, 0\leq{i}\leq{N-1}\f]
513 
514                 \param Dest Source & destination, x()
515                 \param Src Source, y
516                 \param Count Vector length, N
517             */
518             static void Sub (float *, float, long);
519             /// \overload
520             static void Sub (double *, double, long);
521             /// \overload
522             static void Sub (stpSCplx, stSCplx, long);
523             /// \overload
524             static void Sub (stpDCplx, stDCplx, long);
525             /**
526                 Subtract two vectors
527 
528                 \f[x(i)=x(i)-y(i), 0\leq{i}\leq{N-1}\f]
529 
530                 \param Dest Source & destination, x()
531                 \param Src Source, y()
532                 \param Count Vector length, N
533             */
534             static void Sub (float *, const float *, long);
535             /// \overload
536             static void Sub (double *, const double *, long);
537             /// \overload
538             static void Sub (stpSCplx, const stpSCplx, long);
539             /// \overload
540             static void Sub (stpDCplx, const stpDCplx, long);
541             /**
542                 Subtract two vectors and return result in third
543 
544                 \f[z(i)=x(i)-y(i), 0\leq{i}\leq{N-1}\f]
545 
546                 \param Dest Destination, z()
547                 \param Src1 Source 1, x()
548                 \param Src2 Source 2, y()
549                 \param Count Vector length, N
550             */
551             static void Sub (float *, const float *, const float *, long);
552             /// \overload
553             static void Sub (double *, const double *, const double *, long);
554             /// \overload
555             static void Sub (stpSCplx, const stpSCplx, const stpSCplx, long);
556             /// \overload
557             static void Sub (stpDCplx, const stpDCplx, const stpDCplx, long);
558             /**
559                 Multiply vector with single value in-place
560 
561                 \f[x(i)=x(i)y, 0\leq{i}\leq{N-1}\f]
562 
563                 \param Dest Source & destination, x()
564                 \param Src Source, y
565                 \param Count Vector length, N
566             */
567             static void Mul (float *, float, long);
568             /// \overload
569             static void Mul (double *, double, long);
570             /// \overload
571             static void Mul (stpSCplx, float, long);
572             /// \overload
573             static void Mul (stpDCplx, double, long);
574             /// \overload
575             static void Mul (stpSCplx, stSCplx, long);
576             /// \overload
577             static void Mul (stpDCplx, stDCplx, long);
578             /**
579                 Multiply vector with single value out-of-place
580 
581                 \f[z(i)=x(i)y, 0\leq{i}\leq{N-1}\f]
582 
583                 \param Dest Destination, z()
584                 \param Src1 Source 1, x()
585                 \param Src2 Source 2, y
586                 \param Count Vector length, N
587             */
588             static void Mul (float *, const float *, float, long);
589             /// \overload
590             static void Mul (double *, const double *, double, long);
591             /**
592                 Multiply two vectors
593 
594                 \f[x(i)=x(i)y(i), 0\leq{i}\leq{N-1}\f]
595 
596                 \param Dest Source & destination, x()
597                 \param Src Source, y()
598                 \param Count Vector length, N
599             */
600             static void Mul (float *, const float *, long);
601             /// \overload
602             static void Mul (double *, const double *, long);
603             /// \overload
604             static void Mul (stpSCplx, const float *, long);
605             /// \overload
606             static void Mul (stpDCplx, const double *, long);
607             /// \overload
608             static void Mul (stpSCplx, const stpSCplx, long);
609             /// \overload
610             static void Mul (stpDCplx, const stpDCplx, long);
611             /**
612                 Multiply two vectors and return result in third
613 
614                 \f[z(i)=x(i)y(i), 0\leq{i}\leq{N-1}\f]
615 
616                 \param Dest Destination, z()
617                 \param Src1 Source 1, x()
618                 \param Src2 Source 2, y()
619                 \param Count Vector length, N
620             */
621             static void Mul (float *, const float *, const float *, long);
622             /// \overload
623             static void Mul (double *, const double *, const double *, long);
624             /// \overload
625             static void Mul (stpSCplx, const stpSCplx, const stpSCplx, long);
626             /// \overload
627             static void Mul (stpDCplx, const stpDCplx, const stpDCplx, long);
628             /**
629                 Multiply vector with others complex conjugate
630 
631                 \f[X(i)=X(i)Y(i)^{*}, 0\leq{i}\leq{N-1}\f]
632                 \f[Z(i)=X(i)Y(i)^{*}, 0\leq{i}\leq{N-1}\f]
633 
634                 \param Dest Source & destination, X()
635                 \param Src Source, Y()
636                 \param Count Vector length, N
637             */
638             static void MulC (stpSCplx, const stpSCplx, long);
639             /// \overload
640             static void MulC (stpDCplx, const stpDCplx, long);
641             /// \overload
642             static void MulC (stpSCplx, const stpSCplx, const stpSCplx, long);
643             /// \overload
644             static void MulC (stpDCplx, const stpDCplx, const stpDCplx, long);
645             /**
646                 Multiply two vectors in-place with third vector
647 
648                 \f[\left\vert\begin{array}{l}x(i)=x(i)z(i)\\
649                 y(i)=y(i)z(i)\end{array}\right., 0\leq{i}\leq{N-1}\f]
650 
651                 \param Dest1 Source & destination 1, x()
652                 \param Dest2 Source & destination 2, y()
653                 \param Src Source, z()
654                 \param Count Vector length, N
655             */
656             static void Mul2 (float *, float *, const float *, long);
657             /// \overload
658             static void Mul2 (double *, double *, const double *, long);
659             /**
660                 Multiply two vectors out-of-place with third vector and
661                 return results in separate two vectors
662 
663                 \param Dest1 Destination 1
664                 \param Dest2 Destination 2
665                 \param Src1 Source 1
666                 \param Src2 Source 2
667                 \param Count Vector length
668             */
669             static void Mul2 (float *, float *, const float *,
670                 const float *, const float *, long);
671             /// \overload
672             static void Mul2 (double *, double *, const double *,
673                 const double *, const double *, long);
674             /**
675                 Divide vector with single value
676 
677                 \f[x(i)=\frac{x(i)}{y}, 0\leq{i}\leq{N-1}\f]
678 
679                 \param Dest Source & destination, x()
680                 \param Src Source, y
681                 \param Count Vector length, N
682             */
683             static void Div (float *, float, long);
684             /// \overload
685             static void Div (double *, double, long);
686             /// \overload
687             static void Div (stpSCplx, stSCplx, long);
688             /// \overload
689             static void Div (stpDCplx, stDCplx, long);
690             /**
691                 Divide two vectors
692 
693                 \f[x(i)=\frac{x(i)}{y(i)}, 0\leq{i}\leq{N-1}\f]
694 
695                 \param Dest Source & destination, x()
696                 \param Src Source, y()
697                 \param Count Vector length, N
698             */
699             static void Div (float *, const float *, long);
700             /// \overload
701             static void Div (double *, const double *, long);
702             /// \overload
703             static void Div (stpSCplx, const stpSCplx, long);
704             /// \overload
705             static void Div (stpDCplx, const stpDCplx, long);
706             /**
707                 Divide two vectors and return result in third
708 
709                 \f[z(i)=\frac{x(i)}{y(i)}, 0\leq{i}\leq{N-1}\f]
710 
711                 \param Dest Destination, z()
712                 \param Src1 Source 1, x()
713                 \param Src2 Source 2, y()
714                 \param Count Vector length, N
715             */
716             static void Div (float *, const float *, const float *, long);
717             /// \overload
718             static void Div (double *, const double *, const double *, long);
719             /// \overload
720             static void Div (stpSCplx, const stpSCplx, const stpSCplx, long);
721             /// \overload
722             static void Div (stpDCplx, const stpDCplx, const stpDCplx, long);
723             /**
724                 Calculate 1 / value in-place
725 
726                 \f[x(i)=\frac{1}{x(i)}, 0\leq{i}\leq{N-1}\f]
727 
728                 \param Vect Source & destination
729                 \param Count Vector length, N
730             */
731             static void Div1x (float *, long);
732             /// \overload
733             static void Div1x (double *, long);
734             /**
735                 Calculate 1 / value out-of-place
736 
737                 \f[y(i)=\frac{1}{x(i)}, 0\leq{i}\leq{N-1}\f]
738 
739                 \param Dest Destination, y()
740                 \param Src Source, x()
741                 \param Count Vector length, N
742             */
743             static void Div1x (float *, const float *, long);
744             /// \overload
745             static void Div1x (double *, const double *, long);
746             /**
747                 Multiply-add vector in-place
748 
749                 \f[x(i)=x(i)s+o, 0\leq{i}\leq{N-1}\f]
750 
751                 \param Vect Source & destination, x()
752                 \param Mul Multiply value, s
753                 \param Add Addition value, o
754                 \param Count Vector length, N
755             */
756             static void MulAdd (float *, float, float, long);
757             static void MulAdd (double *, double, double, long);
758             /**
759                 Multiply-add vector out-of-place
760 
761                 \f[y(i)=x(i)s+o, 0\leq{i}\leq{N-1}\f]
762 
763                 \param Dest Destination, y()
764                 \param Src Source, x()
765                 \param Mul Multiply value, s
766                 \param Add Addition value, o
767                 \param Count Vector length, N
768             */
769             static void MulAdd (float *, const float *, float, float, long);
770             static void MulAdd (double *, const double *, double, double, long);
771             /**
772                 Multiply-add complex vectors out-of-place
773 
774                 \f[Z(i)=X(i)Y(i), 0\leq{i}\leq{N-1}\f]
775 
776                 \param Dest Destination, Z()
777                 \param Src1 Source 1, X()
778                 \param Src2 Source 2, Y()
779                 \param Count Vector length, N
780             */
781             static void MulAddC (stpSCplx, const stpSCplx, const stpSCplx,
782                 long);
783             static void MulAddC (stpDCplx, const stpDCplx, const stpDCplx,
784                 long);
785             /**
786                 Get absolute value in-place
787 
788                 \f[x(i)=|x(i)|, 0\leq{i}\leq{N-1}\f]
789 
790                 \param Vect Source & destination, x()
791                 \param Count Vector length, N
792             */
793             static void Abs (float *, long);
794             /// \overload
795             static void Abs (double *, long);
796             /**
797                 Get absolute value out-of-place
798 
799                 \f[y(i)=|x(i)|, 0\leq{i}\leq{N-1}\f]
800 
801                 \param Dest Destination, y()
802                 \param Src Source, x()
803                 \param Count Vector length, N
804             */
805             static void Abs (float *, const float *, long);
806             /// \overload
807             static void Abs (double *, const double *, long);
808             /**
809                 Calculate square-roots in-place
810 
811                 \f[x(i)=\sqrt{x(i)}, 0\leq{i}\leq{N-1}\f]
812 
813                 \param Vect Source & destination, x()
814                 \param Count Vector length, N
815             */
816             static void Sqrt (float *, long);
817             /// \overload
818             static void Sqrt (double *, long);
819             /**
820                 Calculate squre-roots out-of-place
821 
822                 \f[y(i)=\sqrt{x(i)}, 0\leq{i}\leq{N-1}\f]
823 
824                 \param Dest Destination, y()
825                 \param Src Source, x()
826                 \param Count Vector length, N
827             */
828             static void Sqrt (float *, const float *, long);
829             /// \overload
830             static void Sqrt (double *, const double *, long);
831             /**
832                 Set all vector elements to zero
833 
834                 \param Vect Vector
835                 \param Count Vector length
836             */
837             static void Zero (float *, long);
838             /// \overload
839             static void Zero (double *, long);
840             /// \overload
841             static void Zero (stpSCplx, long);
842             /// \overload
843             static void Zero (stpDCplx, long);
844             /**
845                 Set all vector elements to specified value
846 
847                 \param Dest Destination
848                 \param Src Source value
849                 \param Count Vector length
850             */
851             static void Set (float *, float, long);
852             /// \overload
853             static void Set (double *, double, long);
854             /// \overload
855             static void Set (stpSCplx, stSCplx, long);
856             /// \overload
857             static void Set (stpDCplx, stDCplx, long);
858             /**
859                 Set specified vector elements to specified value with
860                 boundary check
861 
862                 \param Dest Destination
863                 \param Src Source value
864                 \param Start Starting index
865                 \param Count Number of elements to set
866                 \param Length Vector length
867             */
868             static void Set (float *, float, long, long, long);
869             /// \overload
870             static void Set (double *, double, long, long, long);
871             /// \overload
872             static void Set (stpSCplx, stSCplx, long, long, long);
873             /// \overload
874             static void Set (stpDCplx, stDCplx, long, long, long);
875             /**
876                 Clip vector in-place to specified value
877 
878                 \f[x(i)=\left\{\begin{array}{ll}x(i)&,x(i)\leq{y}\\
879                 y&,x(i)>y\end{array}\right., 0\leq{i}\leq{N-1}\f]
880 
881                 \param Vect Source & destination, x()
882                 \param Value Clipping value, y
883                 \param Count Vector length, N
884             */
885             static void Clip (float *, float, long);
886             /// \overload
887             static void Clip (double *, double, long);
888             /**
889                 Clip vector out-of-place to specified value
890 
891                 \f[z(i)=\left\{\begin{array}{ll}x(i)&,x(i)\leq{y}\\
892                 y&,x(i)>y\end{array}\right., 0\leq{i}\leq{N-1}\f]
893 
894                 \param Dest Destination, z()
895                 \param Src Source, x()
896                 \param Value Clipping value, y
897                 \param Count Vector length, N
898             */
899             static void Clip (float *, const float *, float, long);
900             /// \overload
901             static void Clip (double *, const double *, double, long);
902             /**
903                 Clip vector in-place to fit between specified values
904 
905                 \f[x(i)=\left\{\begin{array}{ll}a&,x(i)<a\\
906                 x(i)&,a\leq{x(i)}\leq{b}\\
907                 b&,x(i)>b\end{array}\right., 0\leq{i}\leq{N-1}\f]
908 
909                 \param Vect Source & destination, x()
910                 \param Min Minimum value, a
911                 \param Max Maximum value, b
912                 \param Count Vector length, N
913             */
914             static void Clip (float *, float, float, long);
915             /// \overload
916             static void Clip (double *, double, double, long);
917             /**
918                 Clip vector out-of-place to fit between specified values
919 
920                 \f[y(i)=\left\{\begin{array}{ll}a&,x(i)<a\\
921                 x(i)&,a\leq{x(i)}\leq{b}\\
922                 b&,x(i)>b\end{array}\right., 0\leq{i}\leq{N-1}\f]
923 
924                 \param Dest Destination, y()
925                 \param Src Source, x()
926                 \param Min Minimum value, a
927                 \param Max Maximum value, b
928                 \param Count Vector length, N
929             */
930             static void Clip (float *, const float *, float, float, long);
931             /// \overload
932             static void Clip (double *, const double *, double, double, long);
933             /**
934                 Clip smallest values in vector to zero (in-place)
935 
936                 \f[x(i)=\left\{\begin{array}{ll}0&,x(i)<0\\
937                 x(i)&,x(i)\leq{0}\end{array}\right., 0\leq{i}\leq{N-1}\f]
938 
939                 \param Vect Source & destination, x()
940                 \param Count Vector length, N
941             */
942             static void ClipZero (float *, long);
943             /// \overload
944             static void ClipZero (double *, long);
945             /**
946                 Clip smallest values in vector to zero (out-of-place)
947 
948                 \f[y(i)=\left\{\begin{array}{ll}0&,x(i)<0\\
949                 x(i)&,x(i)\leq{0}\end{array}\right., 0\leq{i}\leq{N-1}\f]
950 
951                 \param Dest Destination, y()
952                 \param Src Source, x()
953                 \param Count Vector length, N
954             */
955             static void ClipZero (float *, const float *, long);
956             /// \overload
957             static void ClipZero (double *, const double *, long);
958             /**
959                 Copy source vector to destination vector(s)
960 
961                 \param Dest Destination vector
962                 \param Src Source vector
963                 \param Count Vector length
964             */
965             static void Copy (float *, const float *, long);
966             /// \overload
967             static void Copy (double *, const double *, long);
968             /// \overload
969             static void Copy (stpSCplx, const stpSCplx, long);
970             /// \overload
971             static void Copy (stpDCplx, const stpDCplx, long);
972             /// \overload
973             static void Copy (float *, float *, const float *, long);
974             /// \overload
975             static void Copy (double *, double *, const double *, long);
976             /**
977                 Convolve two vectors (same length, finite) without lag
978                 \note Circular convolution, result is not scaled
979 
980                 \f[z=\sum_{i=0}^{K}x(i)y(K-i), K=N-1\f]
981 
982                 \param Src1 Source 1, x()
983                 \param Src2 Source 2, y()
984                 \param Count Vector length, N
985                 \return Convolution result, z
986             */
987             static float Convolve (const float *, const float *, long);
988             /// \overload
989             static double Convolve (const double *, const double *, long);
990             /**
991                 Convolve two vectors (same length, finite) with lag
992                 \note Circular convolution, result is not scaled
993 
994                 \f[z(i)=\sum_{k=0}^{N-1}x(i-k)y(k)\f]
995 
996                 \param Dest Destination, z()
997                 \param Src1 Source 1, x()
998                 \param Src2 Source 2, y()
999                 \param Count Vector length, N
1000             */
1001             static void Convolve (float *, const float *, const float *,
1002                 long);
1003             /// \overload
1004             static void Convolve (double *, const double *, const double *,
1005                 long);
1006             /**
1007                 Correlate two vectors (same length, finite) without lag
1008                 \note Circular correlation, result is scaled
1009 
1010                 \f[z=\frac{1}{N}\sum_{i=0}^{N-1}x(i)y(i)\f]
1011 
1012                 \param Src1 Source1, x()
1013                 \param Src2 Source2, y()
1014                 \param Count Vector length, N
1015                 \return Correlation result, z
1016             */
1017             static float Correlate (const float *, const float *, long);
1018             /// \overload
1019             static double Correlate (const double *, const double *, long);
1020             /**
1021                 Correlate two vectors (same length, finite) with lag
1022                 \note Circular correlation, result is scaled
1023 
1024                 \f[z(i)=\frac{1}{N}\sum_{k=0}^{N-1}x(k)y(k+i)\f]
1025 
1026                 \param Dest Destination, z()
1027                 \param Src1 Source 1, x()
1028                 \param Src2 Source 2, y()
1029                 \param Count Vector length, N
1030             */
1031             static void Correlate (float *, const float *, const float *,
1032                 long);
1033             /// \overload
1034             static void Correlate (double *, const double *, const double *,
1035                 long);
1036             /**
1037                 Autocorrelate vector
1038                 \note Circular, result is scaled
1039 
1040                 \f[z=\frac{1}{N}\sum_{i=0}^{N-1}x(i)^2\f]
1041 
1042                 \param Src Source, x()
1043                 \param Count Vector length, N
1044                 \return Autocorrelation (energy)
1045             */
1046             static float AutoCorrelate (const float *, long);
1047             /// \overload
1048             static double AutoCorrelate (const double *, long);
1049             /**
1050                 Autocorrelate vector
1051                 \note Circular, result is scaled
1052 
1053                 \f[y(i)=\frac{1}{N}\sum_{k=0}^{N-1}x(k)x(k+i)\f]
1054 
1055                 \param Dest Destination, y()
1056                 \param Src Source, x()
1057                 \param Count Vector length, N
1058             */
1059             static void AutoCorrelate (float *, const float *, long);
1060             /// \overload
1061             static void AutoCorrelate (double *, const double *, long);
1062             /**
1063                 Dot product of two vectors
1064 
1065                 \f[z=\sum_{i=0}^{N-1}x(i)y(i)\f]
1066 
1067                 \param Src1 Source 1, x()
1068                 \param Src2 Source 2, y()
1069                 \param Count Vector length, N
1070                 \return Dot product
1071             */
1072             static float DotProduct (const float *, const float *, long);
1073             /// \overload
1074             static double DotProduct (const double *, const double *, long);
1075             /**
1076                 Find minimum and maximum values of vector
1077 
1078                 \param Min Minimum
1079                 \param Max Maximum
1080                 \param Src Source
1081                 \param Count Vector length
1082             */
1083             static void MinMax (float *, float *, const float *, long);
1084             /// \overload
1085             static void MinMax (double *, double *, const double *, long);
1086             /**
1087                 Calculate mean of vector
1088 
1089                 \f[a=\frac{1}{N}\sum_{i=0}^{N-1}x(i)\f]
1090 
1091                 \param Src Source
1092                 \param Count Vector length
1093                 \return Mean
1094             */
1095             static float Mean (const float *, long);
1096             /// \overload
1097             static double Mean (const double *, long);
1098             /**
1099                 Calculate median of vector
1100 
1101                 \f[m=\left\{\begin{array}{ll}x_{sorted}\left(\frac{N}{2}\right)&,N\bmod{2}\neq{0}\\
1102                 0.5\times\left(x_{sorted}\left(\frac{N}{2}-1\right)+x_{sorted}\left(\frac{N}{2}\right)\right)&,N\bmod{2}=0
1103                 \end{array}\right.\f]
1104 
1105                 \param Src Source, x()
1106                 \param Count Vector length, N
1107                 \return Median, m
1108             */
1109             static float Median (const float *, long);
1110             /// \overload
1111             static double Median (const double *, long);
1112             /**
1113                 Negate vector elements
1114 
1115                 \f[x(i)=-x(i), 0\leq{i}\leq{N-1}\f]
1116 
1117                 \param Vect Source & destination
1118                 \param Count Vector length
1119             */
1120             static void Negate (float *, long);
1121             /// \overload
1122             static void Negate (double *, long);
1123             /**
1124                 Negate vector elements
1125 
1126                 \f[y(i)=-x(i), 0\leq{i}\leq{N-1}\f]
1127 
1128                 \param Dest Destination, y()
1129                 \param Src Source, x()
1130                 \param Count Vector length, N
1131             */
1132             static void Negate (float *, const float *, long);
1133             /// \overload
1134             static void Negate (double *, const double *, long);
1135             /**
1136                 Normalize vector elements
1137 
1138                 \f[x(i)=\frac{x(i)-\mu}{\sigma}, 0\leq{i}\leq{N-1}\f]
1139 
1140                 \param Vect Source & destination, x()
1141                 \param Count Vector length, N
1142             */
1143             static void Normalize (float *, long);
1144             /// \overload
1145             static void Normalize (double *, long);
1146             /**
1147                 Normalize vector elements
1148 
1149                 \f[y(i)=\frac{x(i)-\mu}{\sigma}, 0\leq{i}\leq{N-1}\f]
1150 
1151                 \param Dest Destination, y()
1152                 \param Src Source, x()
1153                 \param Count Vector length, N
1154             */
1155             static void Normalize (float *, const float *, long);
1156             /// \overload
1157             static void Normalize (double *, const double *, long);
1158             /**
1159                 Product of vector elements
1160 
1161                 \f[p=\prod{x(i)}, 0\leq{i}\leq{N-1}\f]
1162 
1163                 \param Src Source, x()
1164                 \param Count Vector length, N
1165                 \return Product, p
1166             */
1167             static float Product (const float *, long);
1168             /// \overload
1169             static double Product (const double *, long);
1170             /**
1171                 Reverse vector (in-place)
1172 
1173                 \f[y(i)=x(K-i), K=N-1, 0\leq{i}\leq{N-1}\f]
1174 
1175                 \param Vect Source & destination x()
1176                 \param Count Vector length, N
1177             */
1178             static void Reverse (float *, long);
1179             /// \overload
1180             static void Reverse (double *, long);
1181             /// \overload
1182             static void Reverse (stpSCplx, long);
1183             /// \overload
1184             static void Reverse (stpDCplx, long);
1185             /**
1186                 Reverse vector (out-of-place)
1187 
1188                 \f[y(i)=x(K-i), K=N-1, 0\leq{i}\leq{N-1}\f]
1189 
1190                 \param Dest Destination, y()
1191                 \param Src Source, x()
1192                 \param Count Vector length
1193             */
1194             static void Reverse (float *, const float *, long);
1195             /// \overload
1196             static void Reverse (double *, const double *, long);
1197             /// \overload
1198             static void Reverse (stpSCplx, const stpSCplx, long);
1199             /// \overload
1200             static void Reverse (stpDCplx, const stpDCplx, long);
1201             /**
1202                 Scale (normalize) vector to range [-1:1]
1203 
1204                 \f[x(i)=x(i)\frac{2}{\max-\min}+\left(1-\max\frac{2}{\max-\min}\right), 0\leq{i}\leq{N-1}\f]
1205 
1206                 \param Vect Source & destination, x()
1207                 \param Count Vector length, N
1208             */
1209             static void Scale (float *, long);
1210             /// \overload
1211             static void Scale (double *, long);
1212             /**
1213                 \overload
1214                 \param Dest Destination
1215                 \param Src Source
1216                 \param Count Vector length
1217             */
1218             static void Scale (float *, const float *, long);
1219             /// \overload
1220             static void Scale (double *, const double *, long);
1221             /**
1222                 Scale (normalize) vector to range [0:1]
1223 
1224                 \f[x(i)=x(i)\frac{1}{\max-\min}+\left(-\min\frac{1}{\max-\min}\right), 0\leq{i}\leq{N-1}\f]
1225 
1226                 \param Vect Source & destination, x()
1227                 \param Count Vector length, N
1228             */
1229             static void Scale01 (float *, long);
1230             /// \overload
1231             static void Scale01 (double *, long);
1232             /**
1233                 \overload
1234                 \param Dest Destination
1235                 \param Src Source
1236                 \param Count Vector length
1237             */
1238             static void Scale01 (float *, const float *, long);
1239             /// \overload
1240             static void Scale01 (double *, const double *, long);
1241             /**
1242                 Sort vector elements (in-place).
1243                 Vector is sorted using quick-sort algorithm.
1244 
1245                 \param Vect Source & destination
1246                 \param Count Vector length
1247             */
1248             static void Sort (float *, long);
1249             /// \overload
1250             static void Sort (double *, long);
1251             /// \overload
1252             static void Sort (long *, long);
1253             /**
1254                 Calculate standard deviation and mean of vector
1255 
1256                 \f[\mu=\frac{1}{N}\sum_{i=0}^{N-1}x(i)\f]
1257                 \f[\sigma=\sqrt{\frac{1}{N}\sum_{i=0}^{N-1}(x(i)-\mu)^2}\f]
1258 
1259                 \param StdDev Standard deviation, \f$\sigma\f$
1260                 \param Mean Mean, \f$\mu\f$
1261                 \param Src Source, x()
1262                 \param Count Vector length, N
1263             */
1264             static void StdDev (float *, float *, const float *, long);
1265             /// \overload
1266             static void StdDev (double *, double *, const double *, long);
1267             /**
1268                 Calculate sum of vector elements
1269 
1270                 \f[y=\sum_{i=0}^{N-1}x(i)\f]
1271 
1272                 \param Src Source, x()
1273                 \param Count Vector length, N
1274                 \return Sum, y
1275             */
1276             static float Sum (const float *, long);
1277             /// \overload
1278             static double Sum (const double *, long);
1279             /**
1280                 Square vector in-place
1281 
1282                 \f[x(i)=x(i)^2, 0\leq{i}\leq{N-1}\f]
1283 
1284                 \param Vect Source & destination, x()
1285                 \param Count Vector length, N
1286             */
1287             static void Square (float *, long);
1288             /// \overload
1289             static void Square (double *, long);
1290             /**
1291                 Square vector out-of-place
1292 
1293                 \f[y(i)=x(i)^2, 0\leq{i}\leq{N-1}\f]
1294 
1295                 \param Dest Destination, y()
1296                 \param Src Source, x()
1297                 \param Count Vector length, N
1298             */
1299             static void Square (float *, const float *, long);
1300             /// \overload
1301             static void Square (double *, const double *, long);
1302             /**
1303                 Vector datatype conversion
1304 
1305                 \note 12-bit data in LSBs, 24-bit data in MSBs
1306 
1307                 \param Dest Destination
1308                 \param Src Source
1309                 \param Count Vector length
1310             */
1311             static void Convert (float *, const unsigned char *, long);
1312             /**
1313                 \overload
1314                 \param Dest Destination
1315                 \param Src Source
1316                 \param Count Vector length
1317                 \param 12bit 12-bit data
1318             */
1319             static void Convert (float *, const signed short *, long, bool);
1320             /**
1321                 \overload
1322                 \param Dest Destination
1323                 \param Src Source
1324                 \param Count Vector length
1325                 \param 24bit 24-bit data
1326             */
1327             static void Convert (float *, const signed int *, long, bool);
1328             /// \overload
1329             static void Convert (float *, const double *, long);
1330             /// \overload
1331             static void Convert (double *, const unsigned char *, long);
1332             /// \overload
1333             static void Convert (double *, const signed short *, long, bool);
1334             /// \overload
1335             static void Convert (double *, const signed int *, long, bool);
1336             /// \overload
1337             static void Convert (double *, const float *, long);
1338             /// \overload
1339             static void Convert (unsigned char *, const float *, long);
1340             /// \overload
1341             static void Convert (unsigned char *, const double *, long);
1342             /// \overload
1343             static void Convert (signed short *, const float *, long, bool);
1344             /// \overload
1345             static void Convert (signed short *, const double *, long, bool);
1346             /// \overload
1347             static void Convert (signed int *, const float *, long, bool);
1348             /// \overload
1349             static void Convert (signed int *, const double *, long, bool);
1350             /**
1351                 Convert cartesian to polar vectors (out-of-place).
1352                 See ::Cart2Polar for formula
1353 
1354                 \param Magn Magnitude
1355                 \param Phase Phase
1356                 \param Real Real
1357                 \param Imag Imaginary
1358                 \param Count Vector length
1359             */
1360             static void CartToPolar (float *, float *, const float *,
1361                 const float *, long);
1362             /// \overload
1363             static void CartToPolar (double *, double *, const double *,
1364                 const double *, long);
1365             /**
1366                 \overload
1367                 \param Magn Magnitude
1368                 \param Phase Phase
1369                 \param Cart Cartesian
1370                 \param Count Vector length
1371             */
1372             static void CartToPolar (float *, float *, const stpSCplx, long);
1373             /// \overload
1374             static void CartToPolar (double *, double *, const stpDCplx, long);
1375             /**
1376                 \overload
1377                 \param Polar Polart
1378                 \param Cart Cartesian
1379                 \param Count Vector length
1380             */
1381             static void CartToPolar (stpSPolar, const stpSCplx, long);
1382             /// \overload
1383             static void CartToPolar (stpDPolar, const stpDCplx, long);
1384             /**
1385                 Convert cartesian to polar vectors (in-place)
1386             */
1387             static void CartToPolar (utpSCoord, long);
1388             /// \overload
1389             static void CartToPolar (utpDCoord, long);
1390             /**
1391                 Convert polar to cartesian vectors (out-of-place).
1392                 See ::Polar2Cart for formula
1393 
1394                 \param Real Real
1395                 \param Imag Imaginary
1396                 \param Magn Magnitude
1397                 \param Phase Phase
1398                 \param Count Vector length
1399             */
1400             static void PolarToCart (float *, float *, const float *,
1401                 const float *, long);
1402             /// \overload
1403             static void PolarToCart (double *, double *, const double *,
1404                 const double *, long);
1405             /**
1406                 \overload
1407                 \param Cart Cartesian
1408                 \param Magn Magnitude
1409                 \param Phase Phase
1410                 \param Count Vector length
1411             */
1412             static void PolarToCart (stpSCplx, const float *, const float *,
1413                 long);
1414             /// \overload
1415             static void PolarToCart (stpDCplx, const double *, const double *,
1416                 long);
1417             /**
1418                 \overload
1419                 \param Polar Polar
1420                 \param Cart Cartesian
1421                 \param Count Vector length
1422             */
1423             static void PolarToCart (stpSCplx, const stpSPolar, long);
1424             /// \overload
1425             static void PolarToCart (stpDCplx, const stpDPolar, long);
1426             /**
1427                 Convert cartesian to polar vectors (in-place)
1428             */
1429             static void PolarToCart (utpSCoord, long);
1430             /// \overload
1431             static void PolarToCart (utpDCoord, long);
1432             /**
1433                 Calculate normalized cross correlation of two vectors without
1434                 delay
1435 
1436                 \f[z=\frac{\frac{1}{N}\sum_{i=0}^{N-1}x(i)y(i)}
1437                 {\frac{1}{N}\sqrt{\sum_{i=0}^{N-1}x(i)^2\sum_{i=0}^{N-1}y(i)^2}}\f]
1438 
1439                 \param Src1 Source 1, x()
1440                 \param Src2 Source 2, y()
1441                 \param Count Vector length, N
1442                 \return Normalized cross-correlation
1443             */
1444             static float CrossCorr (const float *, const float *, long);
1445             /// \overload
1446             static double CrossCorr (const double *, const double *, long);
1447             /**
1448                 Calculate normalized cross correlation of two vectors with
1449                 delay in second
1450 
1451                 \f[z=\frac{\frac{1}{K}\sum_{i=0}^{K-1}x(i)y(i+k)}
1452                 {\frac{1}{K}\sqrt{\sum_{i=0}^{K-1}x(i)^2\sum_{i=0}^{K-1}y(i+k)^2}}
1453                 ,K=N-k\f]
1454 
1455                 \param Src1 Source 1, x()
1456                 \param Src2 Source 2, y()
1457                 \param Delay Delay, k
1458                 \param Count Vector length, N
1459                 \return Normalized cross-correlation
1460             */
1461             static float DelCrossCorr (const float *, const float *, long,
1462                 long);
1463             /// \overload
1464             static double DelCrossCorr (const double *, const double *, long,
1465                 long);
1466             /**
1467                 Calculate normalized cross correlation of two vectors
1468                 with delays specified in vector
1469 
1470                 \f[z(j)=\frac{\frac{1}{K}\sum_{i=0}^{K-1}x(i)y(i+k(j))}
1471                 {\frac{1}{K}\sqrt{\sum_{i=0}^{K-1}x(i)^2\sum_{i=0}^{K-1}y(i+k(j))^2}}
1472                 ,K=N-k(j),0\leq{j}\leq{M-1}\f]
1473 
1474                 \param Dest Destination vector, z()
1475                 \param Src1 Source 1, x()
1476                 \param Src2 Source 2, y()
1477                 \param Count Vector length, N
1478                 \param Delay Delays, k()
1479                 \param DelayCount Delay vector length, M
1480             */
1481             static void DelCrossCorr (float *, const float *, const float *,
1482                 long, const long *, long);
1483             /// \overload
1484             static void DelCrossCorr (double *, const double *, const double *,
1485                 long, const long *, long);
1486             /**
1487                 Calculates energy (square) of vector
1488 
1489                 \f[w=\sum_{i=0}^{N-1}x(i)^2\f]
1490 
1491                 \param Src Source, x()
1492                 \param Count Vector length, N
1493                 \return Energy, w
1494             */
1495             static float Energy (const float *, long);
1496             /// \overload
1497             static double Energy (const double *, long);
1498             /**
1499                 Calculates magnitudes (linear) of vector
1500 
1501                 \f[V(i)=\sqrt{\Re_{X}(i)^2+\Im_{X}(i)^2}, 0\leq{i}\leq{N-1}\f]
1502 
1503                 \param Dest Destination, V()
1504                 \param Src Source, X()
1505                 \param Count Vector length
1506             */
1507             static void Magnitude (float *, const stpSCplx, long);
1508             /// \overload
1509             static void Magnitude (double *, const stpDCplx, long);
1510             /**
1511                 Calculates powers (in dB) of vector
1512 
1513                 \f[P(i)=20\log\sqrt{\Re_{X}(i)^2+\Im_{X}(i)^2}, 0\leq{i}\leq{N-1}\f]
1514 
1515                 \param Dest Destination, P()
1516                 \param Src Source, X()
1517                 \param Count Vector length
1518             */
1519             static void Power (float *, const stpSCplx, long);
1520             /// \overload
1521             static void Power (double *, const stpDCplx, long);
1522             /**
1523                 Calculated phases (in rad) of vector
1524 
1525                 \f[\varphi(i)=\arctan{\frac{\Im_{X}(i)}{\Re_{X}(i)}}, 0\leq{i}\leq{N-1}\f]
1526 
1527                 \param Dest Destination, \f$\varphi(i)\f$
1528                 \param Src Source, X()
1529                 \param Count Vector length, N
1530             */
1531             static void Phase (float *, const stpSCplx, long);
1532             /// \overload
1533             static void Phase (double *, const stpDCplx, long);
1534             /**
1535                 Calculates powers (in dB) and phases (in rad) of vector
1536                 See ::Power() and ::Phase() for formulas
1537 
1538                 \param Power Powers
1539                 \param Phase Phases
1540                 \param Src Source
1541                 \param Count Vector length
1542             */
1543             static void PowerPhase (float *, float *, const stpSCplx, long);
1544             /// \overload
1545             static void PowerPhase (double *, double *, const stpDCplx, long);
1546             /**
1547                 Decimate vector without average
1548                 \note This can be used in-place also
1549 
1550                 \param Dest Destination
1551                 \param Src Source
1552                 \param Factor Decimation factor
1553                 \param Count Vector length (source)
1554             */
1555             static void Decimate (float *, const float *, long, long);
1556             /// \overload
1557             static void Decimate (double *, const double *, long, long);
1558             /**
1559                 Decimate vector with average.
1560                 Linear (arithmetic) mean is used to evaluate new values.
1561 
1562                 \param Dest Destination
1563                 \param Src Source
1564                 \param Factor Decimation factor
1565                 \param Count Vector length (source)
1566             */
1567             static void DecimateAvg (float *, const float *, long, long);
1568             /// \overload
1569             static void DecimateAvg (double *, const double *, long, long);
1570             /**
1571                 Iterpolate vector without average (nulling)
1572 
1573                 \param Dest Destination
1574                 \param Src Source
1575                 \param Factor Interpolation factor
1576                 \param Count Vector length (source)
1577             */
1578             static void Interpolate (float *, const float *, long, long);
1579             /// \overload
1580             static void Interpolate (double *, const double *, long, long);
1581             /**
1582                 Interpolate vector with average (linear).
1583                 Lagrange interpolation is used to estimate new values.
1584 
1585                 \f[y(k)=\frac{k-(i+1)}{i-(i+1)}\times{x(i)}+\frac{k-i}{(i+1)-i}\times{x(i+1)}, 0\leq{k}\leq{M-1}, 0\leq{i}\leq{N-1}\f]
1586 
1587                 Where M is destination length and N is source length.
1588 
1589                 \param Dest Destination
1590                 \param Src Source
1591                 \param Factor Interpolation factor
1592                 \param Count Vector length (source)
1593             */
1594             static void InterpolateAvg (float *, const float *, long, long);
1595             static void InterpolateAvg (double *, const double *, long, long);
1596             /**
1597                 Resample vector to different length.
1598 
1599                 \param Dest Destination
1600                 \param DestCount Destionation vector length
1601                 \param Src Source
1602                 \param SrcCount Source vector length
1603             */
1604             static void Resample (float *, long, const float *, long);
1605             static void Resample (double *, long, const double *, long);
1606             /**
1607                 Resample vector to different length with average.
1608 
1609                 \param Dest Destination
1610                 \param DestCount Destination vector length
1611                 \param Src Source
1612                 \param SrcCount Source vector length
1613             */
1614             static void ResampleAvg (float *, long, const float *, long);
1615             static void ResampleAvg (double *, long, const double *, long);
1616             /**
1617                 Calculate RMS (root mean square) of vector
1618 
1619                 \f[I=\sqrt{\frac{\sum_{i=0}^{N-1}x(i)^2}{N}}\f]
1620 
1621                 \param Src Source, x()
1622                 \param Count Vector length, N
1623                 \return RMS, I
1624             */
1625             static float RMS (const float *, long);
1626             /// \overload
1627             static double RMS (const double *, long);
1628             /**
1629                 Calculate variance and mean of vector
1630                 \note variance and mean pointers can be NULL
1631 
1632                 \f[\mu=\frac{1}{N}\sum_{i=0}^{N-1}x(i)\f]
1633                 \f[\sigma^2=\frac{\sum_{i=0}^{N}(x(i)-\mu)^2}{N}\f]
1634 
1635                 \param Variance Variance, \f$\sigma^2\f$
1636                 \param Mean Mean, \f$\mu\f$
1637                 \param Src Source, x()
1638                 \param Count Vector length, N
1639                 \return Variance \f$\sigma^2\f$
1640             */
1641             static float Variance (float *, float *, const float *, long);
1642             /// \overload
1643             static double Variance (double *, double *, const double *, long);
1644             /**
1645                 Find peak level of vector and return result in dB
1646 
1647                 \param Src Source
1648                 \param Count Vector length
1649                 \return Peak level (dB)
1650             */
1651             static float PeakLevel (const float *, long);
1652             /// \overload
1653             static double PeakLevel (const double *, long);
1654             /**
1655                 Calculate Bartlett (triangle) window coefficients
1656 
1657                 \param Dest Destination
1658                 \param Count Vector length
1659             */
1660             void WinBartlett (float *, long);
1661             /// \overload
1662             void WinBartlett (double *, long);
1663             /**
1664                 Calculate Blackman window coefficients
1665 
1666                 \f[y(n)=0.42-0.5\cos\left(\frac{2\pi{n}}{N}\right)+0.08\cos\left(\frac{4\pi{n}}{N}\right), 0\leq{n}\leq{N-1}\f]
1667 
1668                 \param Dest Destination, y()
1669                 \param Count Vector length, N
1670             */
1671             // (destination vector, length)
1672             void WinBlackman (float *, long);
1673             /// \overload
1674             void WinBlackman (double *, long);
1675             /**
1676                 Calculate blackman window coefficients with specified alpha
1677 
1678                 \f[y(n)=\frac{\alpha+1}{2}-0.5\cos\left(\frac{2\pi{n}}{N-1}\right)-\frac{\alpha}{2}\cos\left(\frac{4\pi{n}}{N-1}\right), 0\leq{n}\leq{N-1}\f]
1679 
1680                 or with optimal alpha when alpha is specified as 0
1681 
1682                 \f[\alpha=\frac{0.5}{1+\cos\left(\frac{2\pi}{N-1}\right)}\f]
1683 
1684                 (around -0.25 for large windows)
1685             */
1686             void WinBlackman (float *, long, float);
1687             void WinBlackman (double *, long, double);
1688             /**
1689                 Calculate Blackman-Harris window coefficients
1690 
1691                 \f[y(n)=0.42323-0.49855\cos\left(\frac{2\pi{n}}{N}\right)+0.07922\cos\left(\frac{4\pi{n}}{N}\right), 0\leq{n}\leq{N-1}\f]
1692 
1693                 \param Dest Destination, y()
1694                 \param Count Vector length, N
1695             */
1696             void WinBlackmanHarris (float *, long);
1697             /// \overload
1698             void WinBlackmanHarris (double *, long);
1699             /**
1700                 Calculate cosine tapered window coefficients
1701 
1702                 \f[y(n)=0.5\left(1-\cos\left(\frac{2\pi{n}}{N}\right)\right), 0\leq{n}\leq{N-1}\f]
1703 
1704                 \param Dest Destination, y()
1705                 \param Count Vector length, N
1706             */
1707             void WinCosTapered (float *, long);
1708             /// \overload
1709             void WinCosTapered (double *, long);
1710             /**
1711                 \overload
1712                 Apply cosine tapered window to vector (in-place)
1713             */
1714             void WinCosTaperedA (float *, long);
1715             /// \overload
1716             void WinCosTaperedA (double *, long);
1717             /**
1718                 \overload
1719                 Apply cosine tapered window to vector (out-of-place)
1720             */
1721             void WinCosTaperedA (float *, const float *, long);
1722             /// \overload
1723             void WinCosTaperedA (double *, const double *, long);
1724             /**
1725                 Calculate exact Blackman window coefficients
1726 
1727                 \f[y(n)=\frac{7938}{18608}-\frac{9240}{18608}\cos\left(\frac{2\pi{n}}{N}\right)+\frac{1430}{18608}\cos\left(\frac{4\pi{n}}{N}\right), 0\leq{n}\leq{N-1}\f]
1728 
1729                 \param Dest Destination, y()
1730                 \param Count Vector length, N
1731             */
1732             void WinExactBlackman (float *, long);
1733             /// \overload
1734             void WinExactBlackman (double *, long);
1735             /**
1736                 Calculate exponential window coefficients
1737 
1738                 \f[y(n)=y(N-1-n)=\exp\left(\frac{\ln(z+1)}{N/2}n\right)-1, 0\leq{n}\leq{N/2}\f]
1739 
1740                 \param Dest Destination, y()
1741                 \param Final Final value, z
1742                 \param Count Vector length, N
1743             */
1744             void WinExp (float *, float, long);
1745             /// \overload
1746             void WinExp (double *, double, long);
1747             /**
1748                 Calculate flat top window coefficients
1749 
1750                 \f[y(n)=0.2810639-0.5208972\cos\left(\frac{2\pi{n}}{N}\right)+0.1980399\cos\left(\frac{4\pi{n}}{N}\right), 0\leq{n}\leq{N-1}\f]
1751 
1752                 \param Dest Destination, y()
1753                 \param Count Vector length, N
1754             */
1755             void WinFlatTop (float *, long);
1756             /// \overload
1757             void WinFlatTop (double *, long);
1758             /**
1759                 Calculate generic cosine window coefficients
1760 
1761                 \f[y(n)=\sum_{i=0}^{M-1}-1^{i}x(i)\cos\left(\frac{2\pi{in}}{N}\right), 0\leq{n}\leq{N-1}\f]
1762 
1763                 \param Dest Destination, y()
1764                 \param Count Vector length, N
1765                 \param Coeff Coefficients, x()
1766                 \param CoeffCount Coefficient vector length, M
1767             */
1768             void WinGenericCos (float *, long, const float *, long);
1769             /// \overload
1770             void WinGenericCos (double *, long, const double *, long);
1771             /**
1772                 Calculate Hamming window coefficients
1773 
1774                 \f[y(n)=0.54-0.46\cos\left(\frac{2\pi{n}}{N}\right), 0\leq{n}\leq{N-1}\f]
1775 
1776                 \param Dest Destination vector, y()
1777                 \param Count Vector length, N
1778             */
1779             void WinHamming (float *, long);
1780             /// \overload
1781             void WinHamming (double *, long);
1782             /**
1783                 Calculate Hanning (Hann?) window coefficients
1784 
1785                 \f[y(n)=0.5-0.5\cos\left(\frac{2\pi{n}}{N}\right), 0\leq{n}\leq{N-1}\f]
1786 
1787                 \param Dest Destination vector, y()
1788                 \param Count Vector length, N
1789             */
1790             void WinHanning (float *, long);
1791             /// \overload
1792             void WinHanning (double *, long);
1793             /**
1794                 Calculate Kaiser window coefficients
1795                 See ::ModZeroBessel() for \f$I_{0}\f$
1796 
1797                 \f[y(n)=\frac{I_{0}\left\{\beta\sqrt{1-\left|1-\frac{2n}{N}\right|^2}\right\}}
1798                 {I_{0}\left\{\beta\right\}}, 0\leq{n}\leq{N-1}\f]
1799 
1800                 \param Dest Destination, y()
1801                 \param Beta Beta, \f$\beta\f$
1802                 \param Count Vector length, N
1803             */
1804             void WinKaiser (float *, float, long);
1805             /// \overload
1806             void WinKaiser (double *, double, long);
1807             /**
1808                 Calculate Kaiser-Bessel window coefficients
1809                 See ::ModZeroBessel() for \f$I_{0}\f$
1810 
1811                 \f[w(n_{DFT})=I_{0}\left\{\pi\alpha\left[1.0-\left(\frac{n_{DFT}-N/2}{N/2}\right)^{2}\right]^{1/2}\right\}/I_{0}(\pi\alpha), 0\leq{n_{DFT}}\leq{N-1}\f]
1812 
1813                 \param Dest Destination, w()
1814                 \param Alpha Alpha, \f$\alpha\f$
1815                 \param Count Vector length, N
1816             */
1817             void WinKaiserBessel (float *, float, long);
1818             /// \overload
1819             void WinKaiserBessel (double *, double, long);
1820             /**
1821                 Calculate Tukey window coefficients
1822 
1823                 \f[y(n)=0.5\left[1+\cos\left(\frac{(n-N/2)\pi}{N/2}\right)\right], 0\leq{n}\leq{N-1}\f]
1824 
1825                 \param Dest Destination, y()
1826                 \param Count Vector length, N
1827             */
1828             void WinTukey (float *, long);
1829             /// \overload
1830             void WinTukey (double *, long);
1831             /**
1832                 Calculate Dolph-Chebyshev window coefficients
1833 
1834                 \f[w(n)=\frac{1}{N}\left[1+2r\sum_{m=1}^{M}T_{2M}\left(x_{0}\cos{\frac{\theta_{m}}{2}}\right)\cos{m\theta_{n}}\right], {-M}\leq{n}\leq{M}\f]
1835                 \f[x_{0}=\cosh\left(\frac{1}{2M}\cosh^{-1}\frac{1}{r}\right)\f]
1836 
1837                 Gamma (r) is sidelobe / mainlobe ratio.
1838 
1839                 \param Dest Destination w()
1840                 \param Gamma Gamma (r)
1841                 \param Count Vector length, N
1842             */
1843             void WinDolphChebyshev (float *, float, long);
1844             void WinDolphChebyshev (double *, double, long);
1845             /**
1846                 Mix two channels interleaved in vector
1847 
1848                 \param Dest Destination
1849                 \param Src Source
1850                 \param Count Vector length (destination)
1851             */
1852             static void Mix (float *, const float *, long);
1853             /// \overload
1854             static void Mix (double *, const double *, long);
1855             /**
1856                 \overload
1857                 Mix two channels in separate vectors
1858             */
1859             static void Mix (float *, const float *, const float *, long);
1860             /// \overload
1861             static void Mix (double *, const double *, const double *, long);
1862             /**
1863                 \overload
1864                 Mix n channels interleaved in vector
1865             */
1866             static void Mix (float *, const float *, long, long);
1867             /// \overload
1868             static void Mix (double *, const double *, long, long);
1869             /**
1870                 Spatialize one channel to two channels by inversing others
1871                 phase. For playing mono sound on stereo headphones.
1872 
1873                 \param Dest1 Destination 1
1874                 \param Dest2 Destination 2
1875                 \param Src Source
1876                 \param Count Vector length
1877             */
1878             void Spatialize (float *, float *, const float *, long);
1879             /// \overload
1880             void Spatialize (double *, double *, const double *, long);
1881             /// \overload
1882             void Spatialize (float *, const float *, long);
1883             /// \overload
1884             void Spatialize (double *, const double *, long);
1885             /**
1886                 Extract channel n from N channel interleaved input
1887 
1888                 \param Dest Destination
1889                 \param Src Source
1890                 \param Channel Channel to extract
1891                 \param ChCount Channel count
1892                 \param Count Vector length (source)
1893             */
1894             static void Extract (float *, const float *, long, long, long);
1895             /// \overload
1896             static void Extract (double *, const double *, long, long, long);
1897             /**
1898                 Pack channel n to N channel interleaved output
1899 
1900                 \param Dest Destination
1901                 \param Src Source
1902                 \param Channel Channel to pack
1903                 \param ChCount Channel count
1904                 \param Count Vector length (source)
1905             */
1906             static void Pack (float *, const float *, long, long, long);
1907             /// \overload
1908             static void Pack (double *, const double *, long, long, long);
1909             /**
1910                 Rebuffer to different sized buffer
1911 
1912                 Returns 0 if there was no complete result block,
1913                 recall with new source buffer and same destination buffer.
1914 
1915                 Returns 1 if there was complete result block,
1916                 recall with new source and new destination buffer next time.
1917 
1918                 Returns 2 if source buffer is not yet empty, but one result
1919                 buffer available, recall with same source buffer and new
1920                 destination buffer next time.
1921 
1922                 \param Dest Destination
1923                 \param Src Source
1924                 \param DestCount Destination vector length
1925                 \param SrcCount Source vector length
1926                 \return Rebuffering result
1927             */
1928             long ReBuffer (float *, const float *, long, long);
1929             /// \overload
1930             long ReBuffer (double *, const double *, long, long);
1931             /**
1932                 Convert degrees to radians
1933 
1934                 \f[y=\frac{\pi}{180}x\f]
1935 
1936                 \param Source Degrees, x
1937                 \return Radians, y
1938             */
DegToRad(double dSource)1939             double DegToRad (double dSource)
1940                 { return ((dPI / 180.0) * dSource); }
1941             /// \overload
DegToRad(float fSource)1942             float DegToRad (float fSource)
1943                 { return ((fPI / 180.0F) * fSource); }
1944             /**
1945                 Convert radians to degrees
1946 
1947                 \f[y=\frac{180}{\pi}x\f]
1948 
1949                 \param Source Radians, x
1950                 \param Degrees, y
1951             */
RadToDeg(double dSource)1952             double RadToDeg (double dSource)
1953                 { return ((180.0 / dPI) * dSource); }
1954             /// \overload
RadToDeg(float fSource)1955             float RadToDeg (float fSource)
1956                 { return ((180.0F / fPI) * fSource); }
1957             /**
1958                 Convert Real-FFTW complex output to our Cplx
1959                 \note Destination length is source length / 2 + 1
1960                 \note This is only for FFTW < 3.x
1961             */
1962             static void FFTWConvert (stpSCplx, const float *, long);
1963             /// \overload
1964             static void FFTWConvert (stpDCplx, const float *, long);
1965             /// \overload
1966             static void FFTWConvert (stpSCplx, const double *, long);
1967             /// \overload
1968             static void FFTWConvert (stpDCplx, const double *, long);
1969             /**
1970                 Convert our Cplx to Real-FFTW complex input
1971             */
1972             static void FFTWConvert (float *, const stpSCplx, long);
1973             /// \overload
1974             static void FFTWConvert (float *, const stpDCplx, long);
1975             /// \overload
1976             static void FFTWConvert (double *, const stpSCplx, long);
1977             /// \overload
1978             static void FFTWConvert (double *, const stpDCplx, long);
1979             /**
1980                 Allocate FIR filter
1981 
1982                 \param Coeff Coefficients
1983                 \param Count Vector length
1984             */
1985             void FIRAllocate (const float *, long);
1986             /// \overload
1987             void FIRAllocate (const double *, long);
1988             /**
1989                 Filter using FIR filter
1990 
1991                 \param Vect Source & destination
1992                 \param Count Vector length
1993             */
1994             void FIRFilter (float *, long);
1995             /// \overload
1996             void FIRFilter (double *, long);
1997             /**
1998                 \overload
1999                 \param Dest Destination
2000                 \param Src Source
2001                 \param Count Vector length
2002             */
2003             void FIRFilter (float *, const float *, long);
2004             /// \overload
2005             void FIRFilter (double *, const double *, long);
2006             /**
2007                 Filter using FIR filter (fast version).
2008 
2009                 \note New data at source[FIRlength], must have
2010                 FIRlength size scratch pad at start of source vector.
2011 
2012                 \param Dest Destination
2013                 \param Src Source
2014                 \param Count Vector length
2015             */
2016             void FIRFilterF (float *, float *, long);
2017             /// \overload
2018             void FIRFilterF (double *, double *, long);
2019             /**
2020                 Free FIR filter
2021             */
2022             void FIRFree ();
2023             /**
2024                 Initialize IIR filter.
2025 
2026                 Data format is:
2027                 [0..2] = b[0..2]
2028                 [3..4] = a[0..1]
2029 
2030                 \param Coeffs Coefficient vector of length 5
2031             */
2032             void IIRInitialize (const float *);
2033             /// \overload
2034             void IIRInitialize (const double *);
2035             /**
2036                 Filter using IIR filter.
2037 
2038                 \f[H(z)=\frac{b_{0}+b_{1}z^{-1}+b_{2}z^{-2}}{1-a_{0}z^{-1}-a_{1}z^{-2}}\f]
2039                 \f[y(n)=\sum_{i=1}^{M}a_{i}y(n-i)+\sum_{j=0}^{N}b_{j}x(n-j)\f]
2040 
2041                 \param Vect Source & destination
2042                 \param Count Vector length
2043             */
2044             void IIRFilter (float *, long);
2045             /// \overload
2046             void IIRFilter (double *, long);
2047             /**
2048                 \overload
2049                 \param Dest Destination
2050                 \param Src Source
2051                 \param Count Vector length
2052             */
2053             void IIRFilter (float *, const float *, long);
2054             /// \overload
2055             void IIRFilter (double *, const double *, long);
2056             /**
2057                 Clear IIR filter feedback chain.
2058             */
2059             void IIRClear ();
2060             /**
2061                 Initialize FFT
2062 
2063                 \param Size Transform size
2064                 \param Real Real transform?
2065             */
2066             void FFTInitialize (long, bool);
2067             /**
2068                 Uninitialize FFT
2069             */
2070             void FFTUninitialize ();
2071             /**
2072                 FFT half in-place, source vector is modified.
2073                 \note Output is FFT size / 2 + 1
2074 
2075                 \param Dest Destination
2076                 \param Src Source
2077             */
2078             void FFTi (stpSCplx, float *);
2079             /// \overload
2080             void FFTi (stpDCplx, double *);
2081             /**
2082                 FFT out-of-place.
2083                 \note Output is FFT size / 2 + 1 for real input
2084 
2085                 \param Dest Destination
2086                 \param Src Source
2087             */
2088             void FFTo (stpSCplx, const float *);
2089             /// \overload
2090             void FFTo (stpDCplx, const double *);
2091             /// \overload
2092             void FFTo (stpSCplx, const stpSCplx);
2093             /// \overload
2094             void FFTo (stpDCplx, const stpDCplx);
2095             /**
2096                 IFFT out-of-place.
2097                 \note Input is FFT size / 2 + 1 for real output
2098 
2099                 \param Dest Destination
2100                 \param Src Source
2101             */
2102             void IFFTo (float *, const stpSCplx);
2103             /// \overload
2104             void IFFTo (double *, const stpDCplx);
2105             /// \overload
2106             void IFFTo (stpSCplx, const stpSCplx);
2107             /// \overload
2108             void IFFTo (stpDCplx, const stpDCplx);
2109             /**
2110                 DCT initialize
2111 
2112                 \note Internal state is shared with FFT
2113 
2114                 \param Size Transform size
2115             */
2116             void DCTInitialize (long);
2117             /**
2118                 Uninitialize DCT
2119             */
2120             void DCTUninitialize ();
2121             /**
2122                 DCT in-place
2123 
2124                 \param Vect Source & destination vector
2125             */
2126             void DCTi (float *);
2127             /// \overload
2128             void DCTi (double *);
2129             /**
2130                 DCT out-of-place
2131 
2132                 \param Dest Destination vector
2133                 \param Src Source vector
2134             */
2135             void DCTo (float *, const float *);
2136             /// \overload
2137             void DCTo (double *, const double *);
2138             /**
2139                 Inverse DCT in-place
2140 
2141                 \param Vect Source & destination vector
2142             */
2143             void IDCTi (float *);
2144             /// \overload
2145             void IDCTi (double *);
2146             /**
2147                 Inverse DCT out-of-place
2148 
2149                 \param Dest Destination vector
2150                 \param Src Source vector
2151             */
2152             void IDCTo (float *, const float *);
2153             /// \overload
2154             void IDCTo (double *, const double *);
2155     };
2156 
2157 #endif
2158 
2159