Developer Reference

  • 2021
  • 03/26/2021
  • Public Content
Contents

MaxIndx

Returns the maximum value of a vector and the index of the maximum element.

Syntax

IppStatus ippsMaxIndx_16s(const Ipp16s*
pSrc
, int
len
, Ipp16s*
pMax
, int*
pIndx
);
IppStatus ippsMaxIndx_32s(const Ipp32s*
pSrc
, int
len
, Ipp32s*
pMax
, int*
pIndx
);
IppStatus ippsMaxIndx_32f(const Ipp32f*
pSrc
, int
len
, Ipp32f*
pMax
, int*
pIndx
);
IppStatus ippsMaxIndx_64f(const Ipp64f*
pSrc
, int
len
, Ipp64f*
pMax
, int*
pIndx
);
Include Files
ipps.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
Libraries:
ippcore.lib
,
ippvm.lib
Parameters
pSrc
Pointer to the source vector.
pMax
Pointer to the output result.
len
Number of elements in the vector.
pIndx
Pointer to the index value of the maximum element.
Description
This function returns the maximum value of the input vector
pSrc
, and stores the result in
pMax
. If
pIndx
is not a
NULL
pointer, the function returns the index of the maximum element and stores it in
pIndx
. If there are several equal maximum elements, the first index from the beginning is returned.
Return Values
ippStsNoErr
Indicates no error.
ippStsNullPtrErr
Indicates an error when one of the specified pointers is
NULL
.
ippStsSizeErr
Indicates an error when
len
is less than or equal to 0.

Example

The code example below demonstrates how to use the function
ippsMaxIndx
.
Ipp16s src[] = { 1, -2, 3, 8, -6 }; Ipp16s max; int len = 5; int indx; ippsMaxIndx_16s ( src, len, &max, &indx );
Result:
max = 8 indx = 3

Product and Performance Information

1

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.