Arg
Calculates the argument of two vectors.
The function interface is declared as follows:
Main functions:
HmppResult HMPPS_Arg_32fc(const Hmpp32fc* pSrc, float* pDst, int32_t len);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
pSrc |
Pointer to the source vector |
The value cannot be NULL. |
Input |
pDst |
Pointer to the destination vector |
The value cannot be NULL. |
Output |
len |
Length of the source vector and destination vector |
(0, INT_MAX] |
Input |
Return Value
- Success: HMPP_STS_NO_ERR
- Failure: An error code is returned.
Error Codes
Error Code |
Description |
|---|---|
HMPP_STS_NO_ERR |
No error occurs. |
HMPP_STS_NULL_PTR_ERR |
Any of the specified pointers is NULL. |
HMPP_STS_SIZE_ERR |
The value of srcLen or dstLen is less than or equal to 0. |
Example
#define BUFFER_SIZE_T 10
void ArgExample(void)
{
Hmpp32fc src[BUFFER_SIZE_T] = {1.64, 1.63, -1.09, 0.71, -3.20, -0.43, 0.41, -4.83, 5.36, -4.40};
float dst[BUFFER_SIZE_T];
(void)HMPPS_Zero_32f(dst, BUFFER_SIZE_T); // Initialize all elements of dst to 0.
HmppResult result = HMPPS_Arg_32fc(src, dst, BUFFER_SIZE_T / 2);
printf("result = %d\n", result);
if (result != HMPP_STS_NO_ERR) {
return;
}
printf("dst =");
for (int i = 0; i < BUFFER_SIZE_T; i++) {
printf(" %.2f", dst[i]);
}
printf("\n");
}
int main() {
ArgExample();
return 0;
}
Output:
result = 0 dst = 0.78 2.56 -3.01 -1.49 -0.69 0.00 0.00 0.00 0.00 0.00
Parent topic: Basic and Common Calculations