 libdspl-2.0 Digital Signal Processing Algorithm Library
Math statistic functions.

## Functions

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. More...

int DSPL_API find_max_abs (double *a, int n, double *m, int *ind)
Find maximum absolute value from the real vector a More...

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. More...

## ◆ find_max_abs()

 int find_max_abs ( double * a, int n, double * m, int * ind )

Find maximum absolute value from the real vector a

Function searches maximum absolute value in the real vector a. This value writes to the address m and index keeps to te address ind.

Parameters
 [in] a Pointer to the real vector a. Vector size is [n x 1]. [in] n Size of the input vector a. [out] m Pointer to the variable which keeps vector a maximum absolute value. Pointer can be NULL, maximum value will not return in this case. [out] ind Pointer to the variable which keeps index of a maximum absolute value inside vector a. Pointer can be NULL, index will not return in this case.
Returns
RES_OK if function calculates successfully, else code error.

Example:

double a = {0.0, 2.0, -5.0, 4.0, 2.0};
double m;
int ind;
find_max_abs(a, 5, &m, &ind);
printf("\n\nmax absolute value: %8.1f (index %d)", m, ind);

As result the variable m will keep value 5, and variable ind will keep 2.

Definition at line 123 of file statistic.c.

## ◆ xcorr()

 int 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.

Estimate the cross correlation of vector arguments x and y or estimate autocorrelation vector if .

Cross-correlation vector is defined as:  here .

This function uses the FFT algorithm to estimate the scaled correlation vector: Parameters
 [in] x Pointer to the discrete-time vector x. Vector size is [nx x 1]. [in] nx Size of vector x. [in] y Pointer to the discrete-time vector y. Vector size is [ny x 1]. [in] ny Size of vector y. [in] flag Flag specifies the type of scaling applied to the correlation vector . Is one of: DSPL_XCORR_NOSCALE unscaled correlation vector from IFFT output ; DSPL_XCORR_BIASED biased correlation vector ; DSPL_XCORR_UNBIASED unbiased correlation vector ; [in] nr Maximum correlation lag. Correlation vector is calculated for . [out] r Pointer to the cross-correlation or autocorrelation vector. Vector size is [(2*nr+1) x 1]. Memory must be allocated. [out] r Pointer to the cross-correlation argument vector . Vector size is [(2*nr+1) x 1]. Pointer can be NULL.
Returns
RES_OK if function returns successfully.
Else code error.

Definition at line 214 of file xcorr.c.

## ◆ xcorr_cmplx()

 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 xcorr_cmplx(complex_t* x, int nx, complex_t* y, int ny, int flag, int nr, complex_t* r, double* t) Estimate the cross correlation of vector arguments x and y or estimate autocorrelation vector if .

Cross-correlation vector is defined as:  here .

This function uses the FFT algorithm to estimate the scaled correlation vector: Parameters
 [in] x Pointer to the discrete-time vector x. Vector size is [nx x 1]. [in] nx Size of vector x. [in] y Pointer to the discrete-time vector y. Vector size is [ny x 1]. [in] ny Size of vector y. [in] flag Flag specifies the type of scaling applied to the correlation vector . Is one of: DSPL_XCORR_NOSCALE unscaled correlation vector from IFFT output ; DSPL_XCORR_BIASED biased correlation vector ; DSPL_XCORR_UNBIASED unbiased correlation vector ; [in] nr Maximum correlation lag. Correlation vector is calculated for . [out] r Pointer to the cross-correlation or autocorrelation vector. Vector size is [(2*nr+1) x 1]. Memory must be allocated. [out] r Pointer to the cross-correlation argument vector . Vector size is [(2*nr+1) x 1]. Pointer can be NULL.
Returns
RES_OK if function returns successfully.
Else code error.

Definition at line 449 of file xcorr.c.

int DSPL_API find_max_abs(double *a, int n, double *m, int *ind)
Find maximum absolute value from the real vector a
Definition: statistic.c:123