27int xcorr_fft_size(
int nx,
int ny,
int* pnfft,
int* pndata);
32 int flag,
int nr,
complex_t* r,
double* t);
34int xcorr_scale_cmplx(
complex_t* x,
int nd,
int flag);
126#ifdef DOXYGEN_RUSSIAN
214int DSPL_API
xcorr(
double* x,
int nx,
double* y,
int ny,
215 int flag,
int nr,
double* r,
double* t)
251 err = xcorr_krn(cx, nx, cy, ny, &
fft, flag, nr, cr, t);
255 err =
cmplx2re(cr, 2*nr+1, r, NULL);
273#ifdef DOXYGEN_ENGLISH
361#ifdef DOXYGEN_RUSSIAN
450 int flag,
int nr,
complex_t* r,
double* t)
454 err = xcorr_krn(x, nx, y, ny, &
fft, flag, nr, r, t);
462#ifdef DOXYGEN_ENGLISH
465#ifdef DOXYGEN_RUSSIAN
477 memcpy(r, x+nd-1-nr, (2*nr+1)*
sizeof(
complex_t));
480 memset(r, 0, (2*nr+1) *
sizeof(
complex_t));
481 memcpy(r + nr - nd + 1, x, (2*nd-1)*
sizeof(
complex_t));
484 for(i = 0; i < 2*nr+1; i++)
485 t[i] = (
double)i - (double)nr;
493#ifdef DOXYGEN_ENGLISH
496#ifdef DOXYGEN_RUSSIAN
500 int flag,
int nr,
complex_t* r,
double* t)
514 if(nx < 1 || ny < 1 || nr < 1)
517 err = xcorr_fft_size(nx, ny, &nfft, &ndata);
567 memcpy(px + ndata - 1, x, nx *
sizeof(
complex_t));
578 for(i = 0; i < nfft; i++)
580 RE(pC[i]) = CMCONJRE(pX[i], pY[i]);
581 IM(pC[i]) = CMCONJIM(pX[i], pY[i]);
588 err = xcorr_scale_cmplx(pc, ndata, flag);
592 err = xcorr_get_lag_cmplx(pc, ndata, nr, r, t);
613#ifdef DOXYGEN_ENGLISH
637#ifdef DOXYGEN_RUSSIAN
662int xcorr_fft_size(
int nx,
int ny,
int* pnfft,
int* pndata)
664 int nfft, nfft2, r2, dnfft;
668 if(!pnfft || !pndata)
689 dnfft = 1 << (r2 - 3);
690 while(((1 << r2) + dnfft) < nfft)
692 nfft = (1 << r2) + dnfft;
703#ifdef DOXYGEN_ENGLISH
706#ifdef DOXYGEN_RUSSIAN
709int xcorr_scale_cmplx(
complex_t* x,
int nd,
int flag)
720 case DSPL_XCORR_NOSCALE:
722 case DSPL_XCORR_BIASED:
723 for(i = 0; i < 2 * nd - 1; i++)
725 w = 1.0 / (double)nd;
730 case DSPL_XCORR_UNBIASED:
731 for(i = 1; i < 2 * nd - 1; i++)
733 w = 1.0 / ((double)nd - fabs((
double)(i - nd)));
739 return ERROR_XCORR_FLAG;
void DSPL_API fft_free(fft_t *pfft)
Free fft_t structure.
int DSPL_API fft_cmplx(complex_t *x, int n, fft_t *pfft, complex_t *y)
Fast Fourier transform for the complex vector.
int DSPL_API ifft_cmplx(complex_t *x, int n, fft_t *pfft, complex_t *y)
Inverse fast Fourier transform.
int DSPL_API fft(double *x, int n, fft_t *pfft, complex_t *y)
Fast Fourier transform for the real vector.
#define ERROR_MALLOC
Dynamic memory allocation error. This error means that an error occurred while dynamically allocating...
#define RES_OK
The function completed correctly. No errors.
#define ERROR_PTR
Pointer error. This error means that one of the required pointers (memory to be allocated for) is tra...
#define ERROR_SIZE
Error array size. This error occurs when in addition to the pointer the wrong input is passed to the ...
int DSPL_API xcorr_cmplx(complex_t *x, int nx, complex_t *y, int ny, int flag, int nr, complex_t *r, double *t)
Estimates the cross-correlation vector for complex discrete-time sequences x and y.
int DSPL_API xcorr(double *x, int nx, double *y, int ny, int flag, int nr, double *r, double *t)
Estimates the cross-correlation vector for real discrete-time sequences x and y.
int DSPL_API cmplx2re(complex_t *x, int n, double *re, double *im)
Separate complex vector to the real and image vectors.
int DSPL_API re2cmplx(double *x, int n, complex_t *y)
Convert real array to the complex array.
#define RE(x)
Macro sets real part of the complex number.
double complex_t[2]
Complex data type.
#define IM(x)
Macro sets imaginary part of the complex number.
Fast Fourier Transform Object Data Structure.