1.4.2.78 DSP_VectorMaxIndex32 Function
Returns the index of the maximum value of a vector.
Description
int DSP_VectorMaxIndex32(int32_t *indata, int N);
Returns the index of the highest value of the first N elements of the vector indata. The comparison requires that all numbers be in Q31 fractional data format. N must be greater than or equal to four and a multiple of four, or it will be truncated to the nearest multiple of four.
Preconditions
The pointers outdata and indata must be aligned on 4-byte boundaries. N must be greater than or equal to four and a multiple of four.
Parameters
indata pointer to source array of elements (int32_t)
N number of samples (int)
Returns
int - index of the position of the maximum array element
Remarks
Index values range from 0 .. (n-1).
Example
int indexValue; int Num = 8; int32_t inBufTestA[8]={0x3FFFFFFF, 0x80000000, 0x73333333, 0x66666666, 0x19999999, 0x40000000, 0x7FFFFFFF, 0xB3333334}; _// 0.5, -1, 0.9, 0.8, 0.2, 0.5, 1, -0.6_ indexValue = DSP_VectorMaxIndex32(inBufTestA, Num); _// returnValue = 6 (position corresponding to 0x7FFFFFFF)_
C
int DSP_VectorMaxIndex32 (int32_t * indata , int N );