Strmv

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

  • asdBlasMakeStrmvPlan

    This API initializes the Strmv operator configuration corresponding to the handle.

  • asdBlasStrmv

    This API is used to compute the matrix multiplication of a triangular matrix and a vector in single precision.

Formula:

  • asdBlasStrmv formula
    • Matrix-vector product:
    • Transposed matrix-vector product:
  • Example:

    Input A:

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

    Input x:

    [1,2]

    The input uplo is U, the input trans is T, and the input diag is N.

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

    After the Strmv operator is called, the output x is as follows:

    [7,10]

Function Prototype

  • AspbStatus asdBlasMakeStrmvPlan(asdBlasHandle handle, asdBlasFillMode_t uplo, asdBlasOperation_t trans, int64_t n)
  • AspbStatus asdBlasStrmv(asdBlasHandle handle, asdBlasFillMode_t uplo, asdBlasOperation_t trans, asdBlasDiagType_t diag,const int64_t n, aclTensor* A, const int64_t lda, aclTensor* x, const int64_t incx)

Parameter Description

  • asdBlasMakeStrmvPlan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Handle of the Strmv operator.

    uplo

    Input

    asdBlasFillMode_t

    Storage mode of matrix A.

    ASDBLAS_FILL_MODE_LOWER // Lower triangle
    ASDBLAS_FILL_MODE_UPPER // Upper triangle

    trans

    Input

    asdBlasOperation_t

    Whether to transpose matrix A.

    ASDBLAS_OP_N //Not transposed
    ASDBLAS_OP_T // Transposed

    n

    Input

    int64_t

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

  • asdBlasStrmv

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    strmv operator handle.

    uplo

    Input

    asdBlasFillMode_t

    Storage mode of matrix A.

    ASDBLAS_FILL_MODE_LOWER // Lower triangle
    ASDBLAS_FILL_MODE_UPPER // Upper triangle

    trans

    Input

    asdBlasOperation_t

    Whether to transpose matrix A.

    ASDBLAS_OP_N // Not transposed
    ASDBLAS_OP_T // Transposed

    diag

    Input

    asdBlasDiagType_t

    Specifies whether the diagonal elements of matrix A are assumed to be 1.

    ASDBLAS_DIAG_NON_UNIT // Not assumed to be 1
    ASDBLAS_DIAG_UNIT // Assumed to be 1

    n

    Input

    const int64_t

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

    A

    Input

    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

    Stride of elements in tensor A

    x

    Input/Output

    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

    Stride of elements in vector x

Return Value Description

For details about the return values, see Return Value.

Constraints

  • asdBlasMakeStrmvPlan: none.
  • asdBlasStrmv
    • The input element count n currently supports the range [1, 8192].
    • The input shape of the operator is [n, 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 Strmv.