Rate This Document
Findability
Accuracy
Completeness
Readability

v?pow

Interface Definition

C interface:

void vspow(const int len, const float* src1, const float* src2, float* dst);

void vdpow(const int len, const double* src1, const double* src2, double* dst);

void vcpow(const int len, const float complex *src1, const float complex *src2, float complex *dst);

void vzpow(const int len, const double complex *src1, const double complex *src2, double complex *dst);

Fortran interface:

CALL VSPOW(LEN, SRC1, SRC2, DST);

CALL VDPOW(LEN, SRC1, SRC2, DST);

Parameters

Parameter

Type

Description

Input/Output

len

Integer

Number of elements in the input vector.

If len ≤ 0, the system displays a message indicating that the value of len is invalid.

Input

src1

  • Single-precision floating-point type for vspow
  • Double-precision floating-point type for vdpow
  • Single-precision floating-point complex type for vcpow
  • Double-precision floating-point complex type for vzpow

Input vector src1 with length len.

If the pointer is null, the system prompts a null pointer error.

Input

src2

  • Single-precision floating-point type for vspow
  • Double-precision floating-point type for vdpow
  • Single-precision floating-point complex type for vcpow
  • Double-precision floating-point complex type for vzpow

Input vector src2 with length len.

If the pointer is null, the system prompts a null pointer error.

Input

dst

  • Single-precision floating-point type for vspow
  • Double-precision floating-point type for vdpow
  • Single-precision floating-point complex type for vcpow
  • Double-precision floating-point complex type for vzpow

Output vector dst with length len.

If the pointer is null, the system prompts a null pointer error.

Output

Return Value

  • For vspow and vdpow, special output values are listed as follows:
    • If the value of src1 is greater than 0 and the value of src2 is a decimal, the value range of dst is ∈ (-INF, +INF).
    • If the value of src1 is -0 and the value of src2 is a negative odd number, then the value of dst is -∞. If the value of src1 is ±0 and the value of src2 is a negative number, then the value of dst is +∞.
    • If the value of src1 is ±0 and the value of src2 is a positive odd number, then the value of dst is ±0. If the value of src1 is ±0 and the value of src2 is a positive number, then the value of dst is +0.
    • If the value of src1 is ±1 and the value of src2 is any value, the value of dst is +1.
    • If the value of src1 is any value and the value of src2 is ±0, the value of dst is +1.
    • If the value of src1 is less than +0 and the value of src2 is a decimal, the value of dst is NaN.
    • If the value of |src1| is less than 1 and the value of src2 is -∞, then the value of dst is +∞. If the value of |src1| is greater than 1 and the value of src2 is -∞, then the value of dst is +0.
    • If the value of |src1| is less than 1 and the value of src2 is +∞, then the value of dst is +0. If the value of |src1| is greater than 1 and the value of src2 is +∞, then the value of dst is +∞.
    • If the value of src1 is -∞ and the value of src2 is a negative odd number, then the value of dst is -0. If the value of src1 is -∞ and the value of src2 is a negative number, then the value of dst is +0.
    • If the value of src1 is -∞ and the value of src2 is a positive odd number, then the value of dst is -∞. If the value of src1 is -∞ and the value of src2 is a positive number, then the value of dst is +∞.
    • If the value of src1 is +∞ and the value of src2 is less than +0, the value of dst is +0. If the value of src1 is +∞, the value of dst is +∞.
    • If the values of src1 and src2 are both large finite numbers, the value of dst is ±∞.
    • If the values of src1 and src2 are both NaN, the value of dst is NaN.
  • For vcpow and vzpow, special output values are listed in vcpow.xlsx and vzpow.xlsx.

Dependencies

C: "kvml.h"

Examples

C interface:

    #define N 4
    const float src1[N] = {-2.2f, 1.0f, +INFINITY, -0.0f};
    const float src2[N] = {+2.0f, 111.0f, +1.1f, -6.9f};
    float dst[N] = {0};

    vspow(N, src1, src2, dst);
    printFArr("input1:", N, src1);
    printFArr("input2:", N, src2);
    printFArr("output:", N, dst);

    /** 
     *  input1:  -2.200    1.000      inf   -0.000 
     *  input2:   2.000  111.000    1.100   -6.900
     *  output:   4.840    1.000      inf      inf
     */

Fortran interface:

    INTEGER :: LEN = 4 
    REAL(4) SRC1(4)  
    REAL(4) SRC2(4) 
    REAL(4) DST(4) 
    DATA SRC1 /1.2, 2.5, 2.4, 3.6/ 
    DATA SRC2 /8.6, -2.5, 1.7, 1.3/ 
    CALL VSPOW(LEN, SRC1, SRC2, DST) 
    !  
    ! OUTPUT DST: 
    !     4.79688072, 0.101192884, 4.42954540, 5.28680420 
    !