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

Functions

int DSPL_API find_max_abs (double *a, int n, double *m, int *ind)
 Find maximum absolute value from the real vector a 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]aPointer to the real vector a.
Vector size is [n x 1].

[in]nSize of the input vector a.

[out]mPointer to the variable which keeps vector a maximum absolute value.
Pointer can be NULL, maximum value will not return in this case.

[out]indPointer 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[5] = {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.

Author
Sergey Bakhurin www.dsplib.org

Definition at line 123 of file statistic.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