---
title: v?lgamma
description: "矢量计算输入值的伽马值绝对值的自然对数值，输入为向量。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0646.html
sourcePath: /source/zh/kunpengboostkithistory/240RC2/accel/kunpengaccel_kml_16_0646.html
indexId: cc0fc120ec3f2c9726a871188afe43431d1e6807b22ff8ece3e25d607e5a0c3376
---
# v?lgamma

矢量计算输入值的伽马值绝对值的自然对数值，输入为向量。

#### 接口定义

C interface：

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

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


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| len | 整型数 | 表示输入向量的元素个数。 len≤0时会提示len无效并返回。 | 输入 |
| src | 在vslgamma中是单精度浮点类型。 在vdlgamma中是双精度浮点类型。 | 输入向量src，向量长度为len。 若为空指针，会提示空指针错误并返回。 | 输入 |
| dst | 在vslgamma中是单精度浮点类型。 在vdlgamma中是双精度浮点类型。 | 输出dst，向量长度为len。 若为空指针，会提示空指针错误并返回。 | 输出 |


#### 输出结果

- 每个运算值返回x的伽马值绝对值的自然对数值。
- 其他特殊值参考如下说明。| 输入值（src） | 输出值（dst） |
| --- | --- |
| ±0 | +inf |
| ±inf | +inf |
| nan | nan |


#### 依赖

C: "kvml.h"


#### 示例

C interface：

```
int i, len = 11;
float src[11] = {-100.0f, -1.0f, -0.0f, 0.0f, 0.3f, 0.5f, 1.0f, 100.0f, -INFINITY, INFINITY, NAN};
float* dst = (float*)malloc(sizeof(float) * len);
if (dst == NULL) {
printf("Malloc Failed!\n");
return 0;
}
vslgamma(len, src, dst);
/**
*  Output dst:
*     inf inf inf inf 1.095798 0.572365 0.000000 359.134216 inf inf nan
*/
```
