HCmatinvBatched

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

Not supported

Function Description

API function

  • asdBlasMakeHCmatinvBatchedPlan: initializes the operator configuration corresponding to the handle.
  • asdBlasHCmatinvBatched: computes the inverse of a complex matrix.

Formula:

  • Computation of asdBlasHCmatinvBatched: An inverse matrix of a batch complex matrix is computed. Each complex matrix needs to meet the condition , where A is a non-singular square matrix and an n*n input square matrix, and I is an identity matrix.
  • Example:

    Input A:

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

    Input n: 4

    Input batchSize: 2

    After the asdBlasHCmatinvBatched operator is called, the output Ainv is as follows:

    [0.4+0.4i, -0.1-0.1i,-0.1-0.1i ,-0.1-0.1i
    -0.1-0.1i ,0.4+0.4i ,-0.1-0.1i ,-0.1-0.1i
    -0.1-0.1i ,-0.1-0.1i,0.4+0.4i ,-0.1-0.1i
    -0.1-0.1i ,-0.1-0.1i,-0.1-0.1i,0.4+0.4i]
    
    [0.208+0.208i,-0.0417-0.0417i,-0.0417-0.0417i,-0.0417-0.0417i
    -0.0417-0.0417i,0.208+0.208i,-0.0417-0.0417i,-0.0417-0.0417i
    -0.0417-0.0417i,-0.0417-0.0417i,0.208+0.208i,-0.0417-0.0417i
    -0.0417-0.0417i,-0.0417-0.0417i,-0.0417-0.0417i,0.208+0.208i]

Function Prototype

  • AspbStatus asdBlasMakeHCmatinvBatchedPlan(asdBlasHandle handle, const int64_t n, const int64_t batchSize)
  • AspbStatus asdBlasHCmatinvBatched(asdBlasHandle handle, const int64_t n, aclTensor *A, const int64_t lda,aclTensor *Ainv, const int64_t lda_inv, aclTensor *info, int64_t batchSize)

Parameter Description

  • asdBlasMakeHCmatinvBatchedPlan

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Operator handle.

    n

    Input

    const int64_t

    Number of rows in matrix A in a single batch.

    batchSize

    Input

    const int64_t

    Number of matrices in the complex matrix inversion.

  • asdBlasHCmatinvBatched

    Parameter

    Input/Output

    Type

    Description

    handle

    Input

    asdBlasHandle

    Operator handle.

    n

    Input

    const int64_t

    Number of rows in matrix A.

    A

    Input

    aclTensor *

    Matrix A in the formula, which is in row-major order and is a tensor on the device. The data type is COMPLEX32, the data format is ND, and the shape is [batch, n, n].

    lda

    Input

    const int64_t

    Memory address offset between the left and right adjacent elements of A (currently, the offset is n).

    Ainv

    Output

    aclTensor *

    Output inverse matrix. The data type can only be COMPLEX32, the data format can be ND, and the shape is [batch, n, n].

    lda_inv

    Input

    const int64_t

    Memory address offset between the left and right adjacent elements of the output inverse matrix (currently, the offset is n).

    info

    Input

    aclTensor *

    Information about the inverse result of each batch matrix. The data type can only be int32_t, the data format can be ND, and the shape is [batch, 1].

    batchSize

    Input

    int64_t

    Number of matrices in the complex matrix inversion.

Return Value Description

For details about the return values, see Return Value.

Constraints

  • asdBlasMakeHCmatinvBatchedPlan: none.
  • asdBlasHCmatinvBatched
    • The supported CANN version is CANN 8.0 or later.
    • The lda, lda_inv, and info parameters are not enabled in the current version.
    • The input parameter n is less than or equal to 256.
    • The input parameter batchSize is less than or equal to 3000.

Calling Example

For details about the operator calling example, see HCmatinvBatched.