Mercurial > hg > x
comparison sinest.h @ 5:5f3c32dc6e17
* Adjust comment syntax to permit Doxygen to generate HTML documentation; add Doxyfile
author | Chris Cannam |
---|---|
date | Wed, 06 Oct 2010 15:19:49 +0100 |
parents | fc19d45615d1 |
children | 977f541d6683 |
comparison
equal
deleted
inserted
replaced
4:92ee28024c05 | 5:5f3c32dc6e17 |
---|---|
1 #ifndef SinEstH | 1 #ifndef SinEstH |
2 #define SinEstH | 2 #define SinEstH |
3 | 3 |
4 /* | 4 /** |
5 SinEst.cpp - sinusoid estimation algorithms | 5 \file sinest.h - sinusoid estimation algorithms |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #include <string.h> | 9 #include <string.h> |
10 #include "xcomplex.h" | 10 #include "xcomplex.h" |
116 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); | 116 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); |
117 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); | 117 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); |
118 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); | 118 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); |
119 | 119 |
120 //--local derivative algorithms - general------------------------------------ | 120 //--local derivative algorithms - general------------------------------------ |
121 /* | 121 /** |
122 template DerivativeLSv: local derivative algorithm for estimating time-varying sinusoids, "v" version, | 122 template DerivativeLSv: local derivative algorithm for estimating time-varying sinusoids, "v" version, |
123 i.e. using tuned test functions. | 123 i.e. using tuned test functions. |
124 | 124 |
125 In: s[Wid]: waveform data | 125 In: s[Wid]: waveform data |
126 v[I][Wid], dv[I][Wid]: test functions and their derivatives | 126 v[I][Wid], dv[I][Wid]: test functions and their derivatives |
182 delete[] ind; | 182 delete[] ind; |
183 DeAlloc2(A); | 183 DeAlloc2(A); |
184 return result; | 184 return result; |
185 }//DerivativeLSv | 185 }//DerivativeLSv |
186 | 186 |
187 /* | 187 /** |
188 template DerivativeLS: local derivative algorithm for estimating time-varying sinusoids, "u" version, | 188 template DerivativeLS: local derivative algorithm for estimating time-varying sinusoids, "u" version, |
189 i.e. using base-band test functions. | 189 i.e. using base-band test functions. |
190 | 190 |
191 In: s[Wid]: waveform data | 191 In: s[Wid]: waveform data |
192 u[I][Wid], du[I][Wid]: base-band test functions and their derivatives | 192 u[I][Wid], du[I][Wid]: base-band test functions and their derivatives |
212 cdouble result=DerivativeLSv(Wid, s, I, v, dv, M, h, lmd, p0s, p0, q0s, q0); | 212 cdouble result=DerivativeLSv(Wid, s, I, v, dv, M, h, lmd, p0s, p0, q0s, q0); |
213 DeAlloc2(v); DeAlloc2(dv); | 213 DeAlloc2(v); DeAlloc2(dv); |
214 return result; | 214 return result; |
215 }//DerivativeLS | 215 }//DerivativeLS |
216 | 216 |
217 /* | 217 /** |
218 template DerivativeLS_AmpPh: amplitude and phase estimation in the local derivative algorithm, "u" | 218 template DerivativeLS_AmpPh: amplitude and phase estimation in the local derivative algorithm, "u" |
219 version | 219 version |
220 | 220 |
221 In: sv0: inner product of signal s[Wid] and test function v0 | 221 In: sv0: inner product of signal s[Wid] and test function v0 |
222 u0[Wid], omg: base-band test function and carrier frequency used for computing v0[] | 222 u0[Wid], omg: base-band test function and carrier frequency used for computing v0[] |
236 e0+=exp(expo)**(cdouble(u0[n]).rotate(omg*(n-hWid))); | 236 e0+=exp(expo)**(cdouble(u0[n]).rotate(omg*(n-hWid))); |
237 } | 237 } |
238 return log(sv0/e0); | 238 return log(sv0/e0); |
239 }//DerivativeLS_AmpPh | 239 }//DerivativeLS_AmpPh |
240 | 240 |
241 /* | 241 /** |
242 template DerivativeLS_AmpPh: amplitude and phase estimation in the local derivative algorithm, "u" | 242 template DerivativeLS_AmpPh: amplitude and phase estimation in the local derivative algorithm, "u" |
243 version. | 243 version. |
244 | 244 |
245 In: s[Wid]: waveform data | 245 In: s[Wid]: waveform data |
246 u0[Wid], omg: base-band test function and carrier frequency used for computing v0[] | 246 u0[Wid], omg: base-band test function and carrier frequency used for computing v0[] |
263 return log(ss0/e0); | 263 return log(ss0/e0); |
264 }//DerivativeLS_AmpPh | 264 }//DerivativeLS_AmpPh |
265 | 265 |
266 cdouble DerivativeLSv_AmpPh(int, int, double**, cdouble*, cdouble*, cdouble); //the "v" version is implemented as a normal function in SinEst.cpp. | 266 cdouble DerivativeLSv_AmpPh(int, int, double**, cdouble*, cdouble*, cdouble); //the "v" version is implemented as a normal function in SinEst.cpp. |
267 | 267 |
268 /* | 268 /** |
269 template DerivativeLSv: local derivative algorithm for estimating time-varying sinusoids, "v" version. | 269 template DerivativeLSv: local derivative algorithm for estimating time-varying sinusoids, "v" version. |
270 | 270 |
271 In: s[Wid]: waveform data | 271 In: s[Wid]: waveform data |
272 v[I][Wid], dv[I][Wid]: test functions and their derivatives | 272 v[I][Wid], dv[I][Wid]: test functions and their derivatives |
273 h[M+1][Wid], integr_h[M+1][Wid]: basis functions and their integrals | 273 h[M+1][Wid], integr_h[M+1][Wid]: basis functions and their integrals |
280 { | 280 { |
281 cdouble sv0=DerivativeLSv(Wid, s, I, v, dv, M, h, lmd, p0s, p0, q0s, q0); | 281 cdouble sv0=DerivativeLSv(Wid, s, I, v, dv, M, h, lmd, p0s, p0, q0s, q0); |
282 lmd[0]=DerivativeLSv_AmpPh(Wid, M, integr_h, lmd, v[0], sv0); | 282 lmd[0]=DerivativeLSv_AmpPh(Wid, M, integr_h, lmd, v[0], sv0); |
283 }//DerivativeLSv_AmpPh | 283 }//DerivativeLSv_AmpPh |
284 | 284 |
285 /*template DerivativeLSv: local derivative algorithm for estimating time-varying sinusoids, "u" version. | 285 /** |
286 template DerivativeLSv: local derivative algorithm for estimating time-varying sinusoids, "u" version. | |
286 | 287 |
287 In: s[Wid]: waveform data | 288 In: s[Wid]: waveform data |
288 u[I][Wid], du[I][Wid]: base-band test functions and their derivatives | 289 u[I][Wid], du[I][Wid]: base-band test functions and their derivatives |
289 omg: angular frequency onto which u[I] and du[I] are modulated to give the test functions | 290 omg: angular frequency onto which u[I] and du[I] are modulated to give the test functions |
290 h[M+1][Wid], integr_h[M+1][Wid]: basis functions and their integrals | 291 h[M+1][Wid], integr_h[M+1][Wid]: basis functions and their integrals |
297 { | 298 { |
298 cdouble sv0=DerivativeLS(Wid, s, I, omg, u, du, M, h, lmd, p0s, p0, q0s, q0); | 299 cdouble sv0=DerivativeLS(Wid, s, I, omg, u, du, M, h, lmd, p0s, p0, q0s, q0); |
299 lmd[0]=DerivativeLS_AmpPh(Wid, M, integr_h, lmd, omg, u[0], s); //sv0); | 300 lmd[0]=DerivativeLS_AmpPh(Wid, M, integr_h, lmd, omg, u[0], s); //sv0); |
300 }//DerivativeLSv | 301 }//DerivativeLSv |
301 | 302 |
302 /* | 303 /** |
303 template CosineWindows: generates the Hann^(K/2) window and its L-1 derivatives as Result[L][Wid+1] | 304 template CosineWindows: generates the Hann^(K/2) window and its L-1 derivatives as Result[L][Wid+1] |
304 | 305 |
305 In: K, L, Wid | 306 In: K, L, Wid |
306 Out: w[L][Wid+1]: Hann^(K/2) window function and its derivatives up to order L-1 | 307 Out: w[L][Wid+1]: Hann^(K/2) window function and its derivatives up to order L-1 |
307 | 308 |