CplxToReal
Outputs the real part and the imaginary part of an input complex number.
The function interface declaration is as follows:
- Operations on integers:
HmppResult HMPPS_CplxToReal_16sc(const Hmpp16sc* src, int16_t* dstRe, int16_t* dstIm, int32_t len);
- Operations on floating-point numbers:
HmppResult HMPPS_CplxToReal_32fc(const Hmpp32fc* src, float* dstRe, float* dstIm, int32_t len);
HmppResult HMPPS_CplxToReal_64fc(const Hmpp64fc* src, double* dstRe, double* dstIm, int32_t len);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
src |
Pointer to the source vector |
The value cannot be NULL. |
Input |
dstRe |
Pointer to the real part destination vector of a complex number |
The value cannot be NULL. |
Input |
dstIm |
Pointer to the imaginary part destination vector of a complex number |
The value cannot be NULL. |
Output |
len |
Vector length |
(0, INT_MAX] |
Input |
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, dstRe, or dstIm is NULL. |
HMPP_STS_SIZE_ERR |
The value of len is less than or equal to 0. |
Example
#define BUFFER_SIZE_T 5
void CplxToRealExample(void)
{
Hmpp16sc src[BUFFER_SIZE_T] = {1, 63, 9, 71, 3, 43, 41, 255, 0, 127};
int16_t dstRe[BUFFER_SIZE_T];
int16_t dstIm[BUFFER_SIZE_T];
int32_t i;
HmppResult result = HMPPS_CplxToReal_16sc(src, dstRe, dstIm, BUFFER_SIZE_T);
printf("result = %d \n", result);
if (result != HMPP_STS_NO_ERR) {
return;
}
printf("dst =");
for (i = 0; i < BUFFER_SIZE_T; i++) {
printf(" %d %d ", dstRe[i], dstIm[i]);
}
printf("\n");
}
Output:
result = 0 dst = 1 63 9 71 3 43 41 255 0 127