Rate This Document
Findability
Accuracy
Completeness
Readability

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);

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

  • For vsexp, src is of single-precision floating-point type.
  • For vdexp, src is of double-precision floating-point type.

Input vector src with length len.

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

Input

dst

  • For vsexp, dst is of single-precision floating-point type.
  • For vdexp, dst is of double-precision floating-point type.

Output vector dst with length len.

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

Output

Return Value

  • The exponent y of x with e as the base is returned for each operation value. y ∈ (0, +INF)
  • If the input is +0, the return value is +1.
  • If the input is –0, the return value is +1.
  • If the input of expf is greater than 0x1.62e42ep6f (about 88), the return value is +∞. If the input of exp is greater than 0x1.62p9 (about 708), the return value is +∞.
  • If the input of expf is less than -0x1.9fe368p6f (about -104), the return value is +0. If the input of exp is less than -0x1.62p9 (about -708), the return value is +0.
  • If the input is +∞, the return value is +∞.
  • If the input is -∞, the return value is +0.
  • If the input is NaN, the return value is 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 
    !