计算输入以自然对数为底的指数,输入为向量。
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);
参数名 |
类型 |
描述 |
输入/输出 |
---|---|---|---|
len |
整型数 |
表示输入向量的元素个数。 len≤0时会提示len无效并返回。 |
输入 |
src |
|
输入向量src,向量长度为len。 若为空指针,会提示空指针错误并返回。 |
输入 |
dst |
|
输出dst,向量长度为len。 若为空指针,会提示空指针错误并返回。 |
输出 |
C: "kvml.h"
Fortran: "kvml.f03"
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 !