sinest.h
Go to the documentation of this file.
1 /*
2  Harmonic sinusoidal modelling and tools
3 
4  C++ code package for harmonic sinusoidal modelling and relevant signal processing.
5  Centre for Digital Music, Queen Mary, University of London.
6  This file copyright 2011 Wen Xue.
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of the
11  License, or (at your option) any later version.
12 */
13 #ifndef SinEstH
14 #define SinEstH
15 
21 #include <string.h>
22 #include "xcomplex.h"
23 #include "arrayalloc.h"
24 #include "matrix.h"
25 #ifdef I
26 #undef I
27 #endif
28 
29 //--since function derivative------------------------------------------------
30 double ddsincd_unn(double x, int N);
31 double dsincd_unn(double x, int N);
32 
33 //--window spectrum and derivatives------------------------------------------
34 cdouble* Window(cdouble* x, double f, int N, int M, double* c, int K1, int K2);
35 void dWindow(cdouble* dx, cdouble* x, double f, int N, int M, double* c, int K1, int K2);
36 void ddWindow(cdouble* ddx, cdouble* dx, cdouble* x, double f, int N, int M, double* c, int K1, int K2);
37 
38 //--spectral projection routines---------------------------------------------
39 cdouble IPWindowC(double f, cdouble* x, int N, int M, double* c, double iH2, int K1, int K2);
40 
41 double IPWindow(double f, cdouble* x, int N, int M, double* c, double iH2, int K1, int K2, bool returnamplitude);
42 double IPWindow(double f, void* params);
43 double ddIPWindow(double f, void* params);
44 double ddIPWindow(double f, cdouble* x, int N, int M, double* c, double iH2, int K1, int K2, double& dipwindow, double& ipwindow);
45 
46 double sIPWindow(double f, int L, cdouble** x, int N, int M, double* c, double iH2, int K1, int K2, cdouble* ej2ph=0);
47 double sIPWindow(double f, void* params);
48 double dsIPWindow(double f, int L, cdouble** x, int N, int M, double* c, double iH2, int K1, int K2, double& sip);
49 double dsIPWindow(double f, void* params);
50 double ddsIPWindow(double f, int L, cdouble** x, int N, int M, double* c, double iH2, int K1, int K2, double& dsip, double& sip);
51 double ddsIPWindow(double f, void* params);
52 double ddsIPWindow_unn(double f, cdouble* x, int N, int M, double* c, int K1, int K2, double& dsipwindow, double& sipwindow, cdouble* w_unn=0);
53 
54 double sIPWindowC(double f, int L, double offst_rel, cdouble** x, int N, int M, double* c, double iH2, int K1, int K2, cdouble* ej2ph=0);
55 double sIPWindowC(double f, void* params);
56 double dsIPWindowC(double f, int L, double offst_rel, cdouble** x, int N, int M, double* c, double iH2, int K1, int K2, double& sip);
57 double dsIPWindowC(double f, void* params);
58 double ddsIPWindowC(double f, int L, double offst_rel, cdouble** x, int N, int M, double* c, double iH2, int K1, int K2, double& dsip, double& sip);
59 double ddsIPWindowC(double f, void* params);
60 
61 //--least-square sinusoid estimation routines--------------------------------
62 double LSESinusoid(cdouble* x, int N, double B, int M, double* c, double iH2, double& a, double& pp, double epf=1e-6);
63 void LSESinusoid(double& f, cdouble* x, int N, double B, int M, double* c, double iH2, double& a, double& pp, double epf=1e-6);
64 double LSESinusoid(int f1, int f2, cdouble* x, int N, double B, int M, double* c, double iH2, double& a, double& pp, double epf);
65 int LSESinusoid(double& f, double f1, double f2, cdouble* x, int N, double B, int M, double* c, double iH2, double& a, double& pp, double epf);
66 double LSESinusoidMP(double& f, double f1, double f2, cdouble** x, int Fr, int N, double B, int M, double* c, double iH2, double* a, double* ph, double epf);
67 
68 //--multi-sinusoid spectral projection routines------------------------------
69 void IPMulti(int I, double* f, cdouble* lmd, cdouble* x, int Wid, int K1, int K2, int M, double* c, double eps=0);
70 void IPMulti(int I, double* f, cdouble* lmd, cfloat* x, int Wid, int K1, int K2, int M, double* c, double eps=0, double* sens=0, double* r1=0);
71 void IPMultiSens(int I, double* f, int Wid, int K1, int K2, int M, double* c, double* sens, double eps=0);
72 double IPMulti(int I, double* f, cdouble* lmd, cdouble* x, int Wid, int M, double* c, double iH2, int B);
73 double IPMulti_Direct(int I, double* f, double* ph, double* a, cdouble* x, int Wid, int M, double* c, double iH2, int B);
74 double IPMulti_GS(int I, double* f, double* ph, double* a, cdouble* x, int Wid, int M, double* c, double iH2, int B, double** L=0, double** Q=0);
75 cdouble* IPMulti(int I, int J, double* f, double* ph, double* a, cdouble* x, int Wid, int M, double* c, cdouble** wt=0, cdouble** Q=0, double** L=0, MList* RetList=0);
76 
77 //--dual-sinusoid spectral projection routines-------------------------------
78 double WindowDuo(double df, int N, double* d, int M, cdouble* w);
79 double ddWindowDuo(double df, int N, double* d, int M, double& dwindow, double& window, cdouble* w);
80 double sIPWindowDuo(double f1, double f2, cdouble* x, int N, double* c, double* d, int M, double iH2, int K1, int K2, cdouble& lmd1, cdouble& lmd2);
81 double sIPWindowDuo(double f2, void* params);
82 void ddsIPWindowDuo(double* ddsip2, double f1, double f2, cdouble* x, int N, double* c, double* d, int M, double iH2, int K1, int K2, cdouble& lmd1, cdouble& lmd2);
83 double ddsIPWindowDuo(double f2, void* params);
84 int LSEDuo(double& f2, double fmin, double fmax, double f1, cdouble* x, int N, double B, double* c, double* d, int M, double iH2, cdouble& r1, cdouble &r2, double epf);
85 
86 //--time-frequency reassignment----------------------------------------------
87 void TFReas(double& f, double& t, double& fslope, int Wid, cdouble* data, double* win, double* dwin, double* ddwin, double* plogaslope=0);
88 void TFReas(double& f, double t, double& a, double& ph, double& fslope, int Wid, cdouble* data, double* w, double* dw, double* ddw, double* win=0);
89 
90 //--additive and multiplicative reestimation routines------------------------
91 typedef double (*TBasicAnalyzer)(double* fs, double* as, double* phs, double* das, cdouble* x, int Count, int Wid, int Offst, __int16* ref, int reserved, bool LogA);
92 void AdditiveUpdate(double* fs, double* as, double* phs, double* das, cdouble* x, int Count, int Wid, int Offst, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false);
93 void AdditiveAnalyzer(double* fs, double* as, double* phs, double* das, cdouble* x, int Count, int Wid, int Offst, __int16* ref, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false);
94 void MultiplicativeUpdate(double* fs, double* as, double* phs, double* das, cdouble* x, int Count, int Wid, int Offst, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false);
95 void MultiplicativeAnalyzer(double* fs, double* as, double* phs, double* das, cdouble* x, int Count, int Wid, int Offst, __int16* ref, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false);
96 void MultiplicativeUpdateF(double* fs, double* as, double* phs, __int16* x, int Fr, int frst, int fren, int Wid, int Offst);
97 
98 void ReEstFreq(int FrCount, int Wid, int Offst, double* x, double* fbuf, double* abuf, double* pbuf, double* win, int M, double* c, double iH2, cdouble* w, cdouble* xc, cdouble* xs, double* ps, double* fa, double* fb, double* fc, double* fd, double* ns, int* Wids=0);
99 void ReEstFreq_2(int FrCount, int Wid, int Offst, double* x, double* fbuf, double* abuf, double* pbuf, double* win, int M, double* c, double iH2, cdouble* w, cdouble* xc, cdouble* xs, double* f3, double* f2, double* f1, double* f0, double* ns);
100 void ReEstFreqAmp(int FrCount, int Wid, int Offst, double* x, double* fbuf, double* abuf, double* pbuf, double* win, int M, double* c, double iH2, cdouble* w, cdouble* xc, cdouble* xs, double* ps, double* as, double* fa, double* fb, double* fc, double* fd, double* aa, double* ab, double* ac, double* ad, double* ns, int* Wids=0);
101 int Reestimate2(int FrCount, int Wid, int Offst, double* win, int M, double* c, double iH2, double* x, double* ae, double* fe, double* pe, double* aret, double* fret, double *pret, int maxiter, int* Wids=0);
102 
103 //--local derivative algorithms - DAFx09-------------------------------------
104 void Derivative(int M, double (**h)(double t, void*), double (**dh)(double t, void*), cdouble* r, int p0s, int* p0, int q0s, int* q0, int Wid, double* s, double** win, double omg, void* harg);
105 void DerivativeLS(int K, int M, double (**h)(double t, void* harg), double (**dh)(double t, void* harg), cdouble* r, int p0s, int* p0, int q0s, int* q0, int Wid, double* s, double** win, double omg, void* harg, bool r0=false);
106 void DerivativeLS(int Fr, int K, int M, double (**h)(double t, void* harg), double (**dh)(double t, void* harg), cdouble* r, int p0s, int* p0, int q0s, int* q0, int Wid, double* s, double** win, double omg, void* harg, bool r0=false);
107 
108 //--the Abe-Smith estimator--------------------------------------------------
109 void TFAS05(double& f, double& t, double& a, double& ph, double& aesp, double& fslope, int Wid, double* data, double* w, double res=1);
110 void TFAS05_enh(double& f, double& t, double& a, double& ph, double& aesp, double& fslope, int Wid, double* data, double* w, double res=1);
111 void TFAS05_enh(double& f, double& t, double& a, double& ph, int Wid, double* data, double* w, double res=1);
112 
113 //--piecewise derivative algorithms and tools--------------------------------
114 void DerivativePiecewise(int N, cdouble* aita, int L, double* f, int T, cdouble* s, double*** A, int M, double** h, int I, cdouble** u, cdouble** du, int endmode=0, cdouble* ds=0);
115 void DerivativePiecewise2(int Np, double* p, int Nq, double* q, int L, double* f, int T, cdouble* s, double*** A, double*** B, int M, double** h, int I, cdouble** u, cdouble** du, int endmode=0, cdouble* ds=0);
116 void DerivativePiecewise3(int Np, double* p, int Nq, double* q, int L, double* f, int T, cdouble* s, double*** DA, double*** B, int M, double** h, int I, cdouble** u, cdouble** du, int endmode=0, cdouble* ds=0, double** dh=0);
117 void seth(int M, int T, double**& h, MList* mlist);
118 void setdh(int M, int T, double**& dh, MList* mlist);
119 void setdih(int M, int T, double**& dih, MList* mlist);
120 void setu(int I, int Wid, cdouble**& u, cdouble**& du, int WinOrder=2, MList* mlist=0);
121 void ssALinearSpline(int L, int T, int M, int& N, double*** &A, MList* mlist, int mode=0);
122 void ssACubicHermite(int L, int T, int M, int& N, double*** &A, MList* mlist, int mode=0);
123 void ssACubicSpline(int L, int T, int M, int& N, double*** &A, MList* mlist, int mode=0);
124 void ssLinearSpline(int L, int T, int M, int &N, double** &h, double*** &A, MList* mlist, int mode=0);
125 void ssCubicHermite(int L, int T, int M, int& N, double** &h, double*** &A, MList* mlist, int mode=0);
126 void ssCubicSpline(int L, int T, int M, int& N, double** &h, double*** &A, MList* mlist, int mode=0);
127 void DerivativePiecewiseI(cdouble* aita, int L, double* f, int T, cdouble* s, int M, void (*SpecifyA)(int L, int T, int M, int &N, double*** &A, MList* mlist, int mode), int ssmode=0, int WinOrder=2, int I=2, int endmode=0, cdouble* ds=0);
128 void DerivativePiecewiseII(double* p, double* q, int L, double* f, int T, cdouble* s, int M, void (*SpecifyA)(int L, int T, int M, int &N, double*** &A, MList* mlist, int mode), int ssAmode, void (*SpecifyB)(int L, int T, int M, int &N, double*** &B, MList* mlist, int mode), int ssBmode, int WinOrder=2, int I=2, int endmode=0, cdouble* ds=0);
129 void DerivativePiecewiseIII(double* p, double* q, int L, double* f, int T, cdouble* s, int M, void (*SpecifyA)(int L, int T, int M, int &N, double*** &A, MList* mlist, int mode), int ssAmode, void (*SpecifyB)(int L, int T, int M, int &N, double*** &B, MList* mlist, int mode), int ssBmode, int WinOrder=2, int I=2, int endmode=0, cdouble* ds=0);
130 double AmpPhCorrectionExpA(cdouble* s2, int N, cdouble* aita, int L, int T, cdouble* sre, int M, double** h, double** dih, double*** A, void (*SpecifyA)(int L, int T, int M, int &N, double*** &A, MList* mlist, int mode), int WinOrder);
131 
132 //--local derivative algorithms - general------------------------------------
145 template<class Ts>cdouble DerivativeLSv(int Wid, Ts* s, int I, cdouble** v, cdouble** dv, int M, double **h, cdouble* lmd, int p0s, int* p0, int q0s, int* q0)
146 {
147  int Kr=M*2-p0s-q0s; //number of real unknowns apart from p0 and q0
148  if (I<ceil(Kr/2.0)) throw("insufficient test functions"); //Kr/2 complex equations are needed to solve the unknowns
149 
150  //ind maps the real unknowns to their positions in physical buffer
151  //uind maps them back
152  int *uind=new int[Kr], *ind=new int[2*M];
153  memset(ind, 0, sizeof(int)*2*M);
154  for (int p=0; p<p0s; p++) ind[2*(p0[p]-1)]=-1;
155  for (int q=0; q<q0s; q++) ind[2*(q0[q]-1)+1]=-1;
156 
157  {
158  int p=0, up=0; while (p<2*M){if (ind[p]>=0){uind[up]=p; ind[p]=up; up++;} p++;}
159  if (up!=Kr) throw("");
160  }
161 
162  cdouble* sv1=new cdouble[I];
163  for (int i=0; i<I; i++) sv1[i]=-Inner(Wid, s, dv[i]);
164 
165  double** Allocate2(double, 2*I, Kr, A);
166  for (int m=1; m<=M; m++)
167  for (int i=0; i<I; i++)
168  {
169  int lind;
170  cdouble shv=Inner(Wid, s, h[m], v[i]);
171  if ((lind=ind[2*(m-1)])>=0)
172  {
173  A[2*i][lind]=shv.x;
174  A[2*i+1][lind]=shv.y;
175  }
176  if ((lind=ind[2*m-1])>=0)
177  {
178  A[2*i][lind]=-shv.y;
179  A[2*i+1][lind]=shv.x;
180  }
181  }
182 
183  double* pq=new double[Kr];
184  if (2*I==Kr) GECP(Kr, pq, A, (double*)sv1);
185  else LSLinear(2*I, Kr, pq, A, (double*)sv1);
186 
187  memset(lmd, 0, sizeof(double)*(M+1)*2);
188  for (int k=0; k<Kr; k++) ((double*)(&lmd[1]))[uind[k]]=pq[k];
189 
190  cdouble result=Inner(Wid, s, v[0]);
191  delete[] pq;
192  delete[] sv1;
193  delete[] uind;
194  delete[] ind;
195  DeAlloc2(A);
196  return result;
197 }//DerivativeLSv
198 
212 template<class Ts, class Tu>cdouble DerivativeLS(int Wid, Ts* s, int I, double omg, Tu** u, Tu** du, int M, double **h, cdouble* lmd, int p0s, int* p0, int q0s, int* q0)
213 {
214  cdouble** Allocate2(cdouble, I, Wid, v);
215  cdouble** Allocate2(cdouble, I, Wid, dv);
216  cdouble jomg=cdouble(0, omg); int hWid=Wid/2;
217  for (int c=0; c<Wid; c++)
218  {
219  double t=c-hWid;
220  cdouble rot=cdouble(1).rotate(omg*t);
221  for (int i=0; i<I; i++) v[i][c]=u[i][c]*rot;
222  for (int i=0; i<I; i++) dv[i][c]=du[i][c]*rot+jomg*v[i][c];
223  }
224  cdouble result=DerivativeLSv(Wid, s, I, v, dv, M, h, lmd, p0s, p0, q0s, q0);
225  DeAlloc2(v); DeAlloc2(dv);
226  return result;
227 }//DerivativeLS
228 
239 template<class Tu>cdouble DerivativeLS_AmpPh(int Wid, int M, double** integr_h, cdouble* lmd, double omg, Tu* u0, cdouble sv0)
240 {
241  cdouble e0=0; double hWid=Wid/2.0;
242  for (int n=0; n<Wid; n++)
243  {
244  cdouble expo=0;
245  for (int m=1; m<=M; m++) expo+=lmd[m]*integr_h[m][n];
246  if (expo.x>300) expo.x=300;
247  else if (expo.x<-300) expo.x=-300;
248  e0+=exp(expo)**(cdouble(u0[n]).rotate(omg*(n-hWid)));
249  }
250  return log(sv0/e0);
251 }//DerivativeLS_AmpPh
252 
263 template<class Tu, class Ts>cdouble DerivativeLS_AmpPh(int Wid, int M, double** integr_h, cdouble* lmd, double omg, Tu* u0, Ts* s)
264 {
265  cdouble ss0=0, e0=0; double hWid=Wid/2.0;
266  for (int n=0; n<Wid; n++)
267  {
268  cdouble expo=0;
269  for (int m=1; m<=M; m++) expo+=lmd[m]*integr_h[m][n];
270  if (expo.x>300) expo.x=300;
271  else if (expo.x<-300) expo.x=-300;
272  e0+=~exp(expo)*abs(u0[n]);
273  ss0+=s[n]**exp(expo)*abs(u0[n]);
274  }
275  return log(ss0/e0);
276 }//DerivativeLS_AmpPh
277 
278 cdouble DerivativeLSv_AmpPh(int, int, double**, cdouble*, cdouble*, cdouble); //the "v" version is implemented as a normal function in SinEst.cpp.
279 
291 template<class Ts> void DerivativeLSv(int Wid, Ts* s, int I, cdouble** v, cdouble** dv, int M, double **h, double **integr_h, cdouble* lmd, int p0s, int* p0, int q0s, int* q0)
292 {
293  cdouble sv0=DerivativeLSv(Wid, s, I, v, dv, M, h, lmd, p0s, p0, q0s, q0);
294  lmd[0]=DerivativeLSv_AmpPh(Wid, M, integr_h, lmd, v[0], sv0);
295 }//DerivativeLSv_AmpPh
296 
309 template<class Ts, class Tu>void DerivativeLS(int Wid, Ts* s, int I, double omg, Tu** u, Tu** du, int M, double **h, double **integr_h, cdouble* lmd, int p0s, int* p0, int q0s, int* q0)
310 {
311  cdouble sv0=DerivativeLS(Wid, s, I, omg, u, du, M, h, lmd, p0s, p0, q0s, q0);
312  lmd[0]=DerivativeLS_AmpPh(Wid, M, integr_h, lmd, omg, u[0], s); //sv0);
313 }//DerivativeLSv
314 
323 template<class T>T** CosineWindows(int K, int Wid, T **w, int L=0)
324 {
325  if (L<=0) L=K;
326  if (!w) {Allocate2(T, L, Wid+1, w);}
327  memset(w[0], 0, sizeof(T)*L*(Wid+1));
328  int hWid=Wid/2, dWid=Wid*2;
329  double *s=new double[dWid+hWid], *c=&s[hWid]; //s[n]=sin(pi*n/N), n=0, ..., 2N-1
330  double *C=new double[K+2], *lK=&C[K/2+1], piC=M_PI/Wid;
331  //C[i]=C(K, i)(-1)^i*2^(-K+1), the combination number, i=0, ..., K/2
332  //ik[i]=(K-2i)^k*(M_PI/Wid)^k, i=0, ..., K/2
333  //calculate C(K,i)(-1)^i*2^(-K+1)
334  C[0]=1.0/(1<<(K-1)); double lC=C[0]; for (int i=1; i+i<=K; i++){lC=lC*(K-i+1)/i; C[i]=(i%2)?(-lC):lC;}
335  //calculate sin/cos functions
336  for (int n=0; n<dWid; n++) s[n]=sin(n*piC); memcpy(&s[dWid], s, sizeof(double)*hWid);
337  for (int k=0; k<L; k++)
338  {
339  if (k==0) for (int i=0; i+i<K; i++) lK[i]=C[i];
340  else for (int i=0; i+i<K; i++) lK[i]*=(K-2*i)*piC;
341 
342  if ((K-k)%2) //K-k is odd
343  {
344  for (int i=0; i+i<K; i++) for (int n=0; n<=Wid; n++) w[k][n]+=lK[i]*s[(K-2*i)*n%dWid];
345  if ((K-k-1)/2%2) for (int n=0; n<=Wid; n++) w[k][n]=-w[k][n];
346  }
347  else
348  {
349  for (int i=0; i+i<K; i++) for (int n=0; n<=Wid; n++) w[k][n]+=lK[i]*c[(K-2*i)*n%dWid];
350  if ((K-k)/2%2) for (int n=0; n<=Wid; n++) w[k][n]=-w[k][n];
351  }
352  }
353  if (K%2==0){double tmp=C[K/2]*0.5; if (K/2%2) tmp=-tmp; for (int n=0; n<=Wid; n++) w[0][n]+=tmp;}
354  delete[] s; delete[] C;
355  return w;
356 }//CosineWindows
357 
358 
359 #endif
void TFAS05_enh(double &f, double &t, double &a, double &ph, double &aesp, double &fslope, int Wid, double *data, double *w, double res=1)
Definition: sinest.cpp:2767
void ReEstFreqAmp(int FrCount, int Wid, int Offst, double *x, double *fbuf, double *abuf, double *pbuf, double *win, int M, double *c, double iH2, cdouble *w, cdouble *xc, cdouble *xs, double *ps, double *as, double *fa, double *fb, double *fc, double *fd, double *aa, double *ab, double *ac, double *ad, double *ns, int *Wids=0)
Definition: sinest.cpp:2026
void ReEstFreq_2(int FrCount, int Wid, int Offst, double *x, double *fbuf, double *abuf, double *pbuf, double *win, int M, double *c, double iH2, cdouble *w, cdouble *xc, cdouble *xs, double *f3, double *f2, double *f1, double *f0, double *ns)
Definition: sinest.cpp:1944
double AmpPhCorrectionExpA(cdouble *s2, int N, cdouble *aita, int L, int T, cdouble *sre, int M, double **h, double **dih, double ***A, void(*SpecifyA)(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode), int WinOrder)
Definition: sinest.cpp:3875
void Derivative(int M, double(**h)(double t, void *), double(**dh)(double t, void *), cdouble *r, int p0s, int *p0, int q0s, int *q0, int Wid, double *s, double **win, double omg, void *harg)
Definition: sinest.cpp:2334
void IPMultiSens(int I, double *f, int Wid, int K1, int K2, int M, double *c, double *sens, double eps=0)
Definition: sinest.cpp:1006
T ** CosineWindows(int K, int Wid, T **w, int L=0)
Definition: sinest.h:323
cdouble DerivativeLSv(int Wid, Ts *s, int I, cdouble **v, cdouble **dv, int M, double **h, cdouble *lmd, int p0s, int *p0, int q0s, int *q0)
Definition: sinest.h:145
cdouble DerivativeLS_AmpPh(int Wid, int M, double **integr_h, cdouble *lmd, double omg, Tu *u0, cdouble sv0)
Definition: sinest.h:239
void MultiplicativeAnalyzer(double *fs, double *as, double *phs, double *das, cdouble *x, int Count, int Wid, int Offst, __int16 *ref, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false)
Definition: sinest.cpp:1764
double dsincd_unn(double x, int N)
Definition: sinest.cpp:33
void ddsIPWindowDuo(double *ddsip2, double f1, double f2, cdouble *x, int N, double *c, double *d, int M, double iH2, int K1, int K2, cdouble &lmd1, cdouble &lmd2)
Definition: sinest.cpp:1365
cdouble * Window(cdouble *x, double f, int N, int M, double *c, int K1, int K2)
Definition: sinest.cpp:102
int LSEDuo(double &f2, double fmin, double fmax, double f1, cdouble *x, int N, double B, double *c, double *d, int M, double iH2, cdouble &r1, cdouble &r2, double epf)
Definition: sinest.cpp:1415
void ddWindow(cdouble *ddx, cdouble *dx, cdouble *x, double f, int N, int M, double *c, int K1, int K2)
Definition: sinest.cpp:208
double WindowDuo(double df, int N, double *d, int M, cdouble *w)
Definition: sinest.cpp:1262
void ReEstFreq(int FrCount, int Wid, int Offst, double *x, double *fbuf, double *abuf, double *pbuf, double *win, int M, double *c, double iH2, cdouble *w, cdouble *xc, cdouble *xs, double *ps, double *fa, double *fb, double *fc, double *fd, double *ns, int *Wids=0)
Definition: sinest.cpp:1853
cdouble DerivativeLSv_AmpPh(int, int, double **, cdouble *, cdouble *, cdouble)
Definition: sinest.cpp:2801
double dsIPWindow(double f, int L, cdouble **x, int N, int M, double *c, double iH2, int K1, int K2, double &sip)
Definition: sinest.cpp:401
void AdditiveAnalyzer(double *fs, double *as, double *phs, double *das, cdouble *x, int Count, int Wid, int Offst, __int16 *ref, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false)
Definition: sinest.cpp:1676
void DerivativePiecewiseII(double *p, double *q, int L, double *f, int T, cdouble *s, int M, void(*SpecifyA)(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode), int ssAmode, void(*SpecifyB)(int L, int T, int M, int &N, double ***&B, MList *mlist, int mode), int ssBmode, int WinOrder=2, int I=2, int endmode=0, cdouble *ds=0)
Definition: sinest.cpp:3791
double Inner(int N, double *x, double *y)
Definition: matrix.cpp:1120
double IPMulti_Direct(int I, double *f, double *ph, double *a, cdouble *x, int Wid, int M, double *c, double iH2, int B)
Definition: sinest.cpp:1085
void DerivativePiecewise2(int Np, double *p, int Nq, double *q, int L, double *f, int T, cdouble *s, double ***A, double ***B, int M, double **h, int I, cdouble **u, cdouble **du, int endmode=0, cdouble *ds=0)
Definition: sinest.cpp:3077
Definition: arrayalloc.h:83
double dsIPWindowC(double f, int L, double offst_rel, cdouble **x, int N, int M, double *c, double iH2, int K1, int K2, double &sip)
Definition: sinest.cpp:577
double sIPWindowC(double f, int L, double offst_rel, cdouble **x, int N, int M, double *c, double iH2, int K1, int K2, cdouble *ej2ph=0)
Definition: sinest.cpp:524
void seth(int M, int T, double **&h, MList *mlist)
Definition: sinest.cpp:3485
void DerivativePiecewiseIII(double *p, double *q, int L, double *f, int T, cdouble *s, int M, void(*SpecifyA)(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode), int ssAmode, void(*SpecifyB)(int L, int T, int M, int &N, double ***&B, MList *mlist, int mode), int ssBmode, int WinOrder=2, int I=2, int endmode=0, cdouble *ds=0)
Definition: sinest.cpp:3830
double ddIPWindow(double f, cdouble *x, int N, int M, double *c, double iH2, int K1, int K2, double &dipwindow, double &ipwindow)
Definition: sinest.cpp:296
void DerivativePiecewise(int N, cdouble *aita, int L, double *f, int T, cdouble *s, double ***A, int M, double **h, int I, cdouble **u, cdouble **du, int endmode=0, cdouble *ds=0)
Definition: sinest.cpp:2892
double sIPWindowDuo(double f1, double f2, cdouble *x, int N, double *c, double *d, int M, double iH2, int K1, int K2, cdouble &lmd1, cdouble &lmd2)
Definition: sinest.cpp:1324
void TFAS05(double &f, double &t, double &a, double &ph, double &aesp, double &fslope, int Wid, double *data, double *w, double res=1)
Definition: sinest.cpp:2673
void DerivativeLS(int K, int M, double(**h)(double t, void *harg), double(**dh)(double t, void *harg), cdouble *r, int p0s, int *p0, int q0s, int *q0, int Wid, double *s, double **win, double omg, void *harg, bool r0=false)
Definition: sinest.cpp:2456
void setdh(int M, int T, double **&dh, MList *mlist)
Definition: sinest.cpp:3504
void AdditiveUpdate(double *fs, double *as, double *phs, double *das, cdouble *x, int Count, int Wid, int Offst, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false)
Definition: sinest.cpp:1597
void dWindow(cdouble *dx, cdouble *x, double f, int N, int M, double *c, int K1, int K2)
Definition: sinest.cpp:154
double IPWindow(double f, cdouble *x, int N, int M, double *c, double iH2, int K1, int K2, bool returnamplitude)
Definition: sinest.cpp:269
double ddWindowDuo(double df, int N, double *d, int M, double &dwindow, double &window, cdouble *w)
Definition: sinest.cpp:1291
double LSESinusoid(cdouble *x, int N, double B, int M, double *c, double iH2, double &a, double &pp, double epf=1e-6)
Definition: sinest.cpp:685
void ssLinearSpline(int L, int T, int M, int &N, double **&h, double ***&A, MList *mlist, int mode=0)
Definition: sinest.cpp:3618
double IPMulti_GS(int I, double *f, double *ph, double *a, cdouble *x, int Wid, int M, double *c, double iH2, int B, double **L=0, double **Q=0)
Definition: sinest.cpp:1143
double ddsincd_unn(double x, int N)
Definition: sinest.cpp:62
double ddsIPWindowC(double f, int L, double offst_rel, cdouble **x, int N, int M, double *c, double iH2, int K1, int K2, double &dsip, double &sip)
Definition: sinest.cpp:624
double ddsIPWindow(double f, int L, cdouble **x, int N, int M, double *c, double iH2, int K1, int K2, double &dsip, double &sip)
Definition: sinest.cpp:485
void TFReas(double &f, double &t, double &fslope, int Wid, cdouble *data, double *win, double *dwin, double *ddwin, double *plogaslope=0)
Definition: sinest.cpp:1503
void setu(int I, int Wid, cdouble **&u, cdouble **&du, int WinOrder=2, MList *mlist=0)
Definition: sinest.cpp:3719
void ssALinearSpline(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode=0)
Definition: sinest.cpp:3602
int Reestimate2(int FrCount, int Wid, int Offst, double *win, int M, double *c, double iH2, double *x, double *ae, double *fe, double *pe, double *aret, double *fret, double *pret, int maxiter, int *Wids=0)
Definition: sinest.cpp:2135
double sIPWindow(double f, int L, cdouble **x, int N, int M, double *c, double iH2, int K1, int K2, cdouble *ej2ph=0)
Definition: sinest.cpp:362
double ddsIPWindow_unn(double f, cdouble *x, int N, int M, double *c, int K1, int K2, double &dsipwindow, double &sipwindow, cdouble *w_unn=0)
Definition: sinest.cpp:440
void MultiplicativeUpdate(double *fs, double *as, double *phs, double *das, cdouble *x, int Count, int Wid, int Offst, TBasicAnalyzer BasicAnalyzer, int reserved, bool LogA=false)
Definition: sinest.cpp:1695
cdouble IPWindowC(double f, cdouble *x, int N, int M, double *c, double iH2, int K1, int K2)
Definition: sinest.cpp:335
Definition: xcomplex.h:26
void setdih(int M, int T, double **&dih, MList *mlist)
Definition: sinest.cpp:3524
void ssACubicHermite(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode=0)
Definition: sinest.cpp:3632
void ssCubicHermite(int L, int T, int M, int &N, double **&h, double ***&A, MList *mlist, int mode=0)
Definition: sinest.cpp:3654
void DerivativePiecewiseI(cdouble *aita, int L, double *f, int T, cdouble *s, int M, void(*SpecifyA)(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode), int ssmode=0, int WinOrder=2, int I=2, int endmode=0, cdouble *ds=0)
Definition: sinest.cpp:3756
void ssACubicSpline(int L, int T, int M, int &N, double ***&A, MList *mlist, int mode=0)
Definition: sinest.cpp:3669
void ssCubicSpline(int L, int T, int M, int &N, double **&h, double ***&A, MList *mlist, int mode=0)
Definition: sinest.cpp:3703
void IPMulti(int I, double *f, cdouble *lmd, cdouble *x, int Wid, int K1, int K2, int M, double *c, double eps=0)
Definition: sinest.cpp:930
void DerivativePiecewise3(int Np, double *p, int Nq, double *q, int L, double *f, int T, cdouble *s, double ***DA, double ***B, int M, double **h, int I, cdouble **u, cdouble **du, int endmode=0, cdouble *ds=0, double **dh=0)
Definition: sinest.cpp:3333
double LSESinusoidMP(double &f, double f1, double f2, cdouble **x, int Fr, int N, double B, int M, double *c, double iH2, double *a, double *ph, double epf)
Definition: sinest.cpp:850