Iamax

Applicable Products

Hardware Model

Supported or Not

Atlas 200I/500 A2 inference products

Not supported

Atlas inference products

Not supported

Atlas training products

Not supported

Atlas A2 training products / Atlas A2 inference products

Supported

Atlas A3 inference products / Atlas A3 training products

Supported

Function Description

API function

  • asdBlasMakeIamaxPlan: initializes the Iamax operator configuration corresponding to the handle.
  • asdBlasIsamax: finds the element with the largest absolute value in the real vector and returns its index. If there are multiple equal elements, the smallest index is returned.
  • asdBlasIcamax: finds the element with the largest sum of the absolute values of the imaginary and real parts in a complex vector and returns its index. If the sum of absolute values of multiple elements is equal, the index of the element that is found first is returned.

Formula:

  • asdBlasIsamax formula:
    • Example:

      Input x:

      [3, 4, 4,3]

      After the Isamax operator is called, the output result is as follows:

      2
  • asdBlasIcamax formula: ,

    where Re(x) represents a real part of a complex number, and Im(x) represents an imaginary part of the complex number.

    • Example:

      Input x:

      [3+4i,4-3i,4+2i,3-1i]

      After the Icamax operator is called, the output result is as follows:

      1

Function Prototype

  • AspbStatus asdBlasMakeIamaxPlan(asdBlasHandle handle)
  • AspbStatus asdBlasIcamax(asdBlasHandle handle, const int64_t n, aclTensor *x, const int64_t incx,aclTensor *result)
  • AspbStatus asdBlasIsamax(asdBlasHandle handle, const int64_t n, aclTensor *x, const int64_t incx,aclTensor *result)

Parameter Description

  • asdBlasMakeIamaxPlan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Iamax operator.

  • asdBlasIsamax & asdBlasIcamax

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Iamax operator.

    n

    Input

    const int64_t

    Total number of elements.

    x

    Input

    aclTensor *

    x in the formula, which is a tensor on the device. The data format can be ND, and the shape is [n].

    • For Isamax, the supported data type is FLOAT32.
    • For Icamax, the supported data type is COMPLEX64.

    incx

    Input

    const int64_t

    Memory address increment between consecutive elements of x (currently restricted to 1).

    result

    Output

    aclTensor *

    result in the formula, which is a tensor on the device. The supported data type is INT32. It contains only one element. The data format supports ND, and the shape is [1].

Return Value Description

For details about the return values, see Return Value.

Constraints

  • asdBlasMakeIamaxPlan: none.
  • asdBlasIsamax
    • The input element count n currently supports the range [1, 6.71e+06].
    • The input shape of the operator is [n], and the output shape is [1].
    • The operator does not support the calculation for three or more dimensions.
  • asdBlasIcamax
    • The input element count n currently supports the range [1, 6.71e+06].
    • The input shape of the operator is [n], and the output shape is [1].
    • The operator does not support the calculation for three or more dimensions.

Calling Example

For details about the operator calling example, see Iamax.