Ssyr2

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

  • asdBlasMakeSsyr2Plan: initializes the Ssyr2 operator configuration corresponding to the handle.
  • asdBlasSsyr2: computes the outer product of single-precision vectors and adds the result to a matrix.

Formula:

  • asdBlasSsyr2 formula:
  • Example:

    The input x is as follows:

    [ 1, 2 ]

    The input y is as follows:

    [ 3, 4 ]

    The input A is as follows:

    [   [ 1,2 ],
        [ 3,4 ]  ]

    The input uplo is U.

    The input n is 2, the input lda is 2, the input incx is 1, and the input incy is 1.

    The input alpha is 2.345.

    After the Ssyr2 operator is called, the output A is as follows:

    [   [ 15.07,25.45 ],
        [ 3,     41.52 ]  ].

Function Prototype

  • AspbStatus asdBlasMakeSsyr2Plan(asdBlasHandle handle)
  • AspbStatus asdBlasSsyr2(asdBlasHandle handle, asdBlasFillMode_t uplo, const int64_t n, const float &alpha, aclTensor *x, int64_t incx, aclTensor *y, int64_t incy, aclTensor *A, const int64_t lda)

Parameter Description

  • asdBlasMakeSsyr2Plan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Ssyr2 operator.

  • asdBlasSsyr2

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Ssyr2 operator.

    uplo

    Input

    asdBlasFillMode_t

    Triangular region of matrix A involved in the computation.

    ASDBLAS_FILL_MODE_LOWER // Lower triangle
    ASDBLAS_FILL_MODE_UPPER // Upper triangle

    n

    Input

    const int64_t

    Number of elements in vector x, that is, the number of rows and columns of matrix A.

    alpha

    Input

    const float *

    alpha, the scalar in the formula that scales the vector product.

    x

    Input

    aclTensor *

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

    incx

    Input

    const int64_t

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

    y

    Input

    aclTensor *

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

    incy

    Input

    const int64_t

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

    A

    Input/Output

    aclTensor *

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

    lda

    Input

    const int64_t

    Storage stride of elements in each column of matrix A (currently constrained to n).

Return Value Description

For details about the return values, see Return Value.

Constraints

  • asdBlasMakeSsyr2Plan: none.
  • asdBlasSsyr2
    • The input element count n currently supports the range [1, 8192].
    • The input shape is [n], [n], or [n, n], and the output shape is [n, n].
    • The operator does not support the calculation for three or more dimensions.

Calling Example

For details about the operator calling example, see Ssyr2.