Rate This Document
Findability
Accuracy
Completeness
Readability

Phase

Calculates the phase angle of a given complex vector.

The function interface is declared as follows:

  • Operations on integers:

    HmppResult HMPPS_Phase_16s32f(const int16_t* srcRe, const int16_t* srcIm, float* dst, int32_t len);

    HmppResult HMPPS_Phase_16sc32f(const Hmpp16sc* src, float* dst, int32_t len);

    HmppResult HMPPS_Phase_16s_S(const int16_t* srcRe, const int16_t* srcIm, int16_t* dst, int32_t len, double scale);

    HmppResult HMPPS_Phase_16sc_S(const Hmpp16sc* src, int16_t* dst, int32_t len, double scale);

  • Operations on floating-point numbers:

    HmppResult HMPPS_Phase_32f(const float* srcRe, const float* srcIm, float* dst, int32_t len);

    HmppResult HMPPS_Phase_64f(const double* srcRe, const double* srcIm, double* dst, int32_t len);

    HmppResult HMPPS_Phase_32fc(const Hmpp32fc* src, float* dst, int32_t len);

    HmppResult HMPPS_Phase_64fc(const Hmpp64fc* src, double* dst, int32_t len);

Parameters

Parameter

Description

Value Range

Input/Output

dst

Pointer to the destination vector

The value cannot be NULL.

Output

len

Vector length

(0, INT_MAX]

Input

src

Pointer to the complex vector sequence

Depending on the type

Input

srcRe

Pointer to the real part vector sequence of a complex number

Depending on the type

Input

srcIm

Pointer to the imaginary part vector sequence of a complex number

Depending on the type

Input

scale

Scale factor

scale = 2^n, where n is an integer. The value is within (0, INF).

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 dst is NULL.

HMPP_STS_SIZE_ERR

The value of len is less than or equal to 0.

HMPP_STS_SCALE_ERR

The value of scale is not within the range (0, INF) or is NaN.

Example

#define BUFFER_SIZE_T 10

int main()
{
    double dst[BUFFER_SIZE_T];
    int32_t i;
    double src1[BUFFER_SIZE_T] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    double src2[BUFFER_SIZE_T] = {41.7918, 171.61, 55.8247, 85.8605, 93.5198, 275.385, 229.065, 302.278, 64.373, 309.137};

    HmppResult result = HMPPS_Phase_64f(src1, src2, dst, BUFFER_SIZE_T);
    printf("result = %d \ndst =", result);
    for (i = 0; i < BUFFER_SIZE_T; i++) {
        printf(" %f    ", dst[i]);
    }

    return 0;
} 

Output:

result = 0
dst = 1.570796     1.564969     1.534985     1.535870     1.528051     1.552642     1.544609     1.547643     1.447155     1.541691