我要评分
获取效率
正确性
完整性
易理解

v?exp

Compute the element-wise base-e exponential of a vector.

Interface Definition

C interface:

void vsexp(const int len, const float* src, float* dst);

void vdexp(const int len, const double* src, double* dst);

void vcexp(const int len, const float complex *src, float complex *dst);

void vzexp(const int len, const double complex *src, double complex *dst);

Fortran interface:

CALL VSEXP(LEN, SRC, DST);

CALL VDEXP(LEN, SRC, 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

src

  • Single-precision floating-point type for vsexp
  • Double-precision floating-point type for vdexp
  • Single-precision floating-point complex type for vcexp
  • Double-precision floating-point complex type for vzexp

Input vector src with length len.

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

Input

dst

  • Single-precision floating-point type for vsexp
  • Double-precision floating-point type for vdexp
  • Single-precision floating-point complex type for vcexp
  • Double-precision floating-point complex type for vzexp

Output vector dst with length len.

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

Output

Return Value

Return the result of . For special values, see the following table.

Input Value (src)

Output Value (dst)

+0

+1

-0

+1

-inf

+0

+inf

+inf

nan

nan

Dependencies

C: "kvml.h"

Fortran: "kvml.f03"

Examples

C interface:

    int i, len = 4; 
    float src[len] = {0.0f, INFINITY, NAN, 2.0f}; 
    float* dst = (float*)malloc(sizeof(float) * len); 
    if (dst == NULL) { 
        printf("Malloc Failed!\n"); 
        return 0; 
    } 
    vsexp(len, src, dst); 
    /** 
     *  Output dst: 
     *     0.0  inf  nan  7.389056205749512 
     * 
     */

Fortran interface:

    INTEGER :: LEN = 2 
    REAL(4) SRC(2)  
    REAL(4) DST(2) 
    DATA SRC /1.0, 2.0/ 
    CALL VSPOW(LEN, SRC, DST) 
    !  
    ! OUTPUT DST: 
    !     0.0 7.389056205749512 
    !