---
title: i?amin
description: "实数向量返回最小绝对值的索引值，复数向量返回实部绝对值和虚部绝对值之和的最小值索引值。"
url: https://www.hikunpeng.com/document/detail/zh/hpchistory/hpckit/develop2400/kunpengaccel_kml_0568.html
sourcePath: /source/zh/hpchistory/hpckit/develop2400/kunpengaccel_kml_0568.html
indexId: a1983b0ff702ba44b4924b851e0991a2b520da1975f4eb6079e58469e880b82c67
---
# i?amin

实数向量返回最小绝对值的索引值，复数向量返回实部绝对值和虚部绝对值之和的最小值索引值。

#### 接口定义

C interface：

CBLAS_INDEX cblas_isamin(const BLASINT n, const float *x, const BLASINT incx);

CBLAS_INDEX cblas_idamin(const BLASINT n, const double *x, const BLASINT incx);

CBLAS_INDEX cblas_icamin(const BLASINT n, const void *x, const BLASINT incx);

CBLAS_INDEX cblas_izamin(const BLASINT n, const void *x, const BLASINT incx);

Fortran interface：

INDEX = ISAMIN(N, X, INCX)

INDEX = IDAMIN(N, X, INCX)

INDEX = ICAMIN(N, X, INCX)

INDEX = IZAMIN(N, X, INCX)


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| n | 整型数 | 表示x向量的元素个数。 | 输入 |
| x | 在isamin中是双精度浮点类型。 在idamin中是单精度浮点类型。 在icamin中是单精度复数类型。 在izamin中是双精度复数类型。 | 向量x，向量规模至少是(1+(n\-1)\*abs(incX))。 | 输入 |
| incx | 整型数 | 表示x向量增长步长。 | 输入 |


#### 返回值

实数向量返回最小绝对值的索引值，复数向量返回实部绝对值和虚部绝对值之和的最小值索引值。CBLAS_INDEX类型。


#### 依赖

#include "kblas.h"


#### 示例

C interface：

```
int n = 5, incx = 1; 
    int res; 
    /** 
     *   X:  0.340188, -0.105617, 0.283099, 0.298440, 0.411647 
     */ 
    float x[5] = {0.340188, -0.105617, 0.283099, 0.298440, 0.411647}; 
 
    res = cblas_isamin(n, x, incx); 
    /** 
     * Output:  1 
     */
```

Fortran interface：

```
INTEGER :: N=5
INTEGER :: INCX=1
INTEGER :: INDEX
REAL(4) :: X(5)
DATA X/0.340188, -0.105617, 0.283099, 0.298440, 0.411647/
EXTERNAL ISAMIN
INDEX=ISAMIN(N, X, INCX)
*     Output : 1
```
