Caxpy

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:

  • asdBlasMakeCaxpyPlan: initializes the Caxpy operator configuration corresponding to the handle.
  • asdBlasCaxpy: multiplies a complex-number vector by a complex-number scalar and adds a complex-number vector.

Formula:

  • asdBlasCaxpy formula:
  • Example:

    Input x:

    [3.0 + 4.0j, 4.0 + 4.0j]

    Input alpha:

    3.0 + 4.0j

    Input y:

    [3.0 + 4.0j, 4.0 + 4.0j]

    After the Caxpy operator is called, the output y is as follows:

    [-4.0 + 28.0j, 0.0 + 32.0j]

Function Prototype

  • AspbStatus asdBlasMakeCaxpyPlan(asdBlasHandle handle)
  • AspbStatus asdBlasCaxpy(asdBlasHandle handle, const int64_t n, const std::complex<float> *alpha, aclTensor* x,int64_t incx, aclTensor* y, int64_t incy)

Parameter Description

  • asdBlasMakeCaxpyPlan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Caxpy operator handle.

  • asdBlasCaxpy

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Caxpy operator handle.

    n

    Input

    const int64_t

    Number of complex elements in the vector

    alpha

    Input

    const std::complex<float> *

    Alpha in the formula, which is the input complex scalar. The data type can be COMPLEX64.

    x

    Input

    aclTensor*

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

    incx

    Input

    int64_t

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

    y

    Input/Output

    aclTensor*

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

    incy

    Input

    int64_t

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

Return Value Description

For details about the return values, see Return Value.

Constraints

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

Calling Example

For details about the operator calling example, see Caxpy.