v?hypot
Compute the square root of the sum of the squares of src1 and src2. src1, src2, and the result are all vectors.
Interface Definition
C interface:
void vshypot(const int len, const float* src1, const float* src2, float* dst);
void vdhypot(const int len, const double* src1, const double* src2, 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 |
src1 |
|
Input vector src1 with length len. If the pointer is null, a null pointer error is reported and the function returns. |
Input |
src2 |
|
Input vector src2 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
is returned. The value range is |(–inf, inf)|.
Input Value 1 (src1) |
Input Value 2 (src2) |
Output Value (dst) |
|---|---|---|
snan |
any |
nan |
any |
snan |
nan |
±inf |
!=snan |
inf |
!=snan |
±inf |
inf |
qnan |
(-inf, inf) |
nan |
(-inf, inf) |
qnan |
nan |
|
inf |
|
Dependencies
C: "kvml.h"
Examples
C interface:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #define N 4 const float src1[N] = {3.0f, 5.0f, 8.44f, NAN}; const float src2[N] = {-4.0f, 12.0f, -INFINITY, 1.0f}; float dst[N] = {0}; vshypot(N, src1, src2, dst); printFArr("input1:", N, src1); printFArr("input2:", N, src2); printFArr("output:", N, dst); /** * input1: 3.000 5.000 8.440 nan * input2: -4.000 12.000 -inf 1.000 * output: 5.000 13.000 inf nan */ |
