libdspl-2.0
Digital Signal Processing Algorithm Library
|
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 | mean (double *x, int n, double *m) |
Calculates the mean of the input vector x More... | |
int DSPL_API | mean_cmplx (complex_t *x, int n, complex_t *m) |
Calculates the mean of the complex input vector x More... | |
int DSPL_API | stat_std (double *x, int n, double *s) |
Calculates the standard deviation of the input vector x More... | |
int DSPL_API | stat_std_cmplx (complex_t *x, int n, double *s) |
Calculates the standard deviation of the complex input vector x 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... | |
Detailed Description
Function Documentation
◆ 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 beNULL
, 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 beNULL
, index will not return in this case.
- Returns
RES_OK
if function calculates successfully, else code error.
Example:
As result the variable m
will keep value 5
, and variable ind
will keep 2
.
Definition at line 121 of file find_max_abs.c.
◆ mean()
int mean | ( | double * | x, |
int | n, | ||
double * | m | ||
) |
Calculates the mean of the input vector x
Function calculates the mean value
\[ m = \frac{1}{n}\sum_{i = 0}^{n-1} x(i) \]
- Parameters
-
[in] x Pointer to the real input vector x
.
Vector size is[n x 1]
.
[in] n Size of input vector x
.
[out] m Pointer to the variable which keeps vector x
mean value.
Memory must be allocated.
RES_OK
if function calculates successfully, else code error.
Example:
As result the variable m
will keep value 2
.
Definition at line 105 of file mean.c.
Referenced by stat_std().
◆ mean_cmplx()
Calculates the mean of the complex input vector x
Function calculates the mean value
\[ m = \frac{1}{n}\sum_{i = 0}^{n-1} x(i) \]
- Parameters
-
[in] x Pointer to the complex input vector x
.
Vector size is[n x 1]
.
[in] n Size of input vector x
.
[out] m Pointer to the variable which keeps vector x
mean value.
Memory must be allocated.
RES_OK
if function calculates successfully, else code error.
Example:
As result the variable m
will keep value 1 + 3j
.
Definition at line 108 of file mean_cmplx.c.
Referenced by stat_std_cmplx().
◆ stat_std()
int stat_std | ( | double * | x, |
int | n, | ||
double * | s | ||
) |
Calculates the standard deviation of the input vector x
Function calculates the the standard deviation value
\[ s = \sqrt{\frac{1}{n-1} \sum_{i = 0}^{n-1} \big(x(i) - \mu \big)^2}, \]
here \(\mu\) - mean value of the vector x
:
\[ \mu = \frac{1}{n} \sum_{i = 0}^{n-1} x(i). \]
- Parameters
-
[in] x Pointer to the real input vector x
.
Vector size is[n x 1]
.
[in] n Size of input vector x
.
[out] s Pointer to the variable which keeps vector x
standard deviation value.
Memory must be allocated.
RES_OK
if function calculates successfully, else code error.
Example:
As result the variable s
will keep value 1.5811
.
Definition at line 116 of file stat_std.c.
◆ stat_std_cmplx()
int stat_std_cmplx | ( | complex_t * | x, |
int | n, | ||
double * | s | ||
) |
Calculates the standard deviation of the complex input vector x
Function calculates the the standard deviation value
\[ s = \sqrt{\frac{1}{n-1} \sum_{i = 0}^{n-1} \big|x(i) - \mu \big|^2}, \]
here \(\mu\) - mean value of the vector x
:
\[ \mu = \frac{1}{n} \sum_{i = 0}^{n-1} x(i). \]
- Parameters
-
[in] x Pointer to the complex input vector x
.
Vector size is[n x 1]
.
[in] n Size of input vector x
.
[out] s Pointer to the variable which keeps vector x
standard deviation value.
Memory must be allocated.
RES_OK
if function calculates successfully, else code error.
Example:
As result the variable s
will keep value 3.3665
.
Definition at line 113 of file stat_std_cmplx.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 \(\widehat{r}_{xy}(k)\) of vector arguments x
and y
or estimate autocorrelation vector if \(x = y \).
Cross-correlation vector is defined as:
\[ \widehat{r}_{xy}(k) = \frac{1}{N-k} \sum\limits_{n = 0}^{N-k-1} x(n+k)y^*(n), \qquad 0 \leq k <N; \]
\[ \widehat{r}_{xy}(k) = \frac{1}{N+k} \sum\limits_{n = 0}^{N+k-1} y^*(n-k)x(n), \qquad -N < k < 0. \]
here \( N = \max(n_x, n_y) \).
This function uses the FFT algorithm to estimate the scaled correlation vector:
\[ \breve{r}_{xy}(k) = \operatorname{IFFT}\Big[ \operatorname{FFT}\big[ \mathbf{x} \big] \operatorname{FFT}^*\big[ \mathbf{y} \big] \Big] \]
- 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 \(\breve{r}_{xy}(k)\).
Is one of:
DSPL_XCORR_NOSCALE
unscaled correlation vector from IFFT output \(\breve{r}_{xy}(k)\);
DSPL_XCORR_BIASED
biased correlation vector \(\breve{r}_{xy}(k)/N \);
DSPL_XCORR_UNBIASED
unbiased correlation vector \(\widehat{r}_{xy}(k) = \frac{\breve{r}_{xy}(k)}{N-|k|} \);
[in] nr Maximum correlation lag.
Correlation vector \(\widehat{r}_{xy}(k)\) is calculated for \( k= -n_r,\,\, -n_r +1, \ldots n_r\).
[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
\( k= -n_r,\,\, -n_r +1, \ldors n_r\).
Vector size is[(2*nr+1) x 1]
.
Pointer can beNULL
.
- Returns
RES_OK
if function returns successfully.
Else code error.
◆ 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 \(\widehat{r}_{xy}(k)\) of vector arguments x
and y
or estimate autocorrelation vector if \(x = y \).
Cross-correlation vector is defined as:
\[ \widehat{r}_{xy}(k) = \frac{1}{N-k} \sum\limits_{n = 0}^{N-k-1} x(n+k)y^*(n), \qquad 0 \leq k <N; \]
\[ \widehat{r}_{xy}(k) = \frac{1}{N+k} \sum\limits_{n = 0}^{N+k-1} y^*(n-k)x(n), \qquad -N < k < 0. \]
here \( N = \max(n_x, n_y) \).
This function uses the FFT algorithm to estimate the scaled correlation vector:
\[ \breve{r}_{xy}(k) = \operatorname{IFFT}\Big[ \operatorname{FFT}\big[ \mathbf{x} \big] \operatorname{FFT}^*\big[ \mathbf{y} \big] \Big] \]
- 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 \(\breve{r}_{xy}(k)\).
Is one of:
DSPL_XCORR_NOSCALE
unscaled correlation vector from IFFT output \(\breve{r}_{xy}(k)\);
DSPL_XCORR_BIASED
biased correlation vector \(\breve{r}_{xy}(k)/N \);
DSPL_XCORR_UNBIASED
unbiased correlation vector \(\widehat{r}_{xy}(k) = \frac{\breve{r}_{xy}(k)}{N-|k|} \);
[in] nr Maximum correlation lag.
Correlation vector \(\widehat{r}_{xy}(k)\) is calculated for \( k= -n_r,\,\, -n_r +1, \ldots n_r\).
[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
\( k= -n_r,\,\, -n_r +1, \ldors n_r\).
Vector size is[(2*nr+1) x 1]
.
Pointer can beNULL
.
- Returns
RES_OK
if function returns successfully.
Else code error.
Generated on Wed Jan 5 2022 12:44:37 for libdspl-2.0 by 1.9.2