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

i?amax

Return the index of the maximum absolute value of a real number vector, and return the index of the maximum sum of the absolute values of the real part and the imaginary part of a complex number vector.

Interface Definition

C interface:

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

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

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

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

Fortran interface:

INDEX = ISAMAX(N, X, INCX)

INDEX = IDAMAX(N, X, INCX)

INDEX = ICAMAX(N, X, INCX)

INDEX = IZAMAX(N, X, INCX)

Parameters

Parameter

Type

Description

Input/Output

n

Integer

Number of elements in the x vector.

Input

x

  • Double-precision floating-point type for isamax
  • Single-precision floating-point type for idamax
  • Single-precision complex type for icamax
  • Double-precision complex type for izamax

Vector x. The vector size is at least (1+(n-1)*abs(incX)).

Input

incx

Integer

Increment for the elements of vector x.

Input

Return Value

For a real number vector, the index of the maximum absolute value is returned. For a complex number vector, the index of the maximum sum of the absolute values of the real part and the imaginary part is returned. It is of the CBLAS_INDEX type.

Dependency

#include "kblas.h"

Examples

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_isamax(n, x, incx); 
    /** 
     * Output:  4 
     */

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 ISAMAX 
      INDEX=ISAMAX(N, X, INCX) 
 
*     Output : 4