Min
Obtains the minimum value in a vector.
The function interface declaration is as follows:
- Operations on integers:
HmppResult HMPPS_Min_16s(const int16_t *src, int32_t len, int16_t *min);
HmppResult HMPPS_Min_32s(const int32_t *src, int32_t len, int32_t *min);
- Operations on floating-point numbers:
HmppResult HMPPS_Min_32f(const float *src, int32_t len, float *min);
HmppResult HMPPS_Min_64f(const double *src, int32_t len, double *min);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
src |
Pointer to the source vector |
The value cannot be NULL. |
Input |
len |
Vector length |
(0, INT_MAX] |
Input |
min |
Pointer to the minimum value |
The value cannot be NULL. |
Output |
Return Value
- Success: HMPP_STS_NO_ERR
- Failure: An error code is returned.
Error Codes
Error Code |
Description |
|---|---|
HMPP_STS_NULL_PTR_ERR |
The value of src or min is NULL. |
HMPP_STS_SIZE_ERR |
The value of len is less than or equal to 0. |
Example
#define BUFFER_SIZE_T 10
void MinExample(void)
{
int16_t src[BUFFER_SIZE_T] = {3, 6, 2, 8, 3, 15, 56, 31, 1, 23};
int16_t min;
HmppResult result = HMPPS_Min_16s(src, BUFFER_SIZE_T, &min);
printf("result = %d ", result);
if (result != HMPP_STS_NO_ERR) {
return;
}
printf("min = %d\n", min);
}
Output:
result = 0 min = 1
Parent topic: Basic and Common Calculations