v?arg
Compute the argument of the input complex number, that is, the arctangent value of the ratio of the imaginary part to the real part.
Interface Definition
C interface:
void vcarg(const int len, const float complex* src, float* dst);
void vzarg(const int len, const double complex* src, double* dst);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
len |
Integer |
Number of elements in the input vector. If len ≤ 0, an invalid parameter error is reported and the function returns. |
Input |
src |
|
Input vector src with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Input |
dst |
|
Output vector dst with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Output |
Return Value
- The argument of the input complex number is returned for each operation value. The formula is: arg(x + yi) = arctan(y/x)
- For special values, see the following table.
RE(z)
i * IM(z)
-∞
-X
-0
+0
+X
+∞
NAN
+i * ∞
+∞+i*∞
+π/2
+π/2
+π/2
+π/2
+π/4
NAN
+i * Y
+π
-
+π/2
+π/2
-
+0
NAN
+i * 0
+π
+π
+π
+0
+0
+0
NAN
-i * 0
-π
-π
-π
-0
-0
-0
NAN
-i * Y
-π
-
-π/2
-π/2
-
-0
NAN
-i * ∞
-3*π/4
-π/2
-π/2
-π/2
-π/2
-π/4
NAN
+i * NAN
NAN
NAN
NAN
NAN
NAN
NAN
NAN
Dependencies
C: "kvml.h"
Examples
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #define N 4 const complex float src[N] = { __builtin_complex(-8.0f, 25.0f), __builtin_complex(+INFINITY, -2.1f), __builtin_complex(2.6f, 25.0f), __builtin_complex(-0.0f, +0.1f) }; float dst[N] = {0}; vcarg(N, src, dst); printFArr("output:", N, dst); /** * input: (-8.000,25.000) ( inf,-2.100) (2.600,25.000) (-0.000,0.100) * output: 1.880 -0.000 1.467 1.571 */ |