---
title: HCmatinvBatched
description: "| 硬件型号 | 支持情况 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/SiP/SIP_API_0090.html
sourcePath: /source/zh/canncommercial/900/API/SiP/SIP_API_0090.html
indexId: e3b077abe51b52dcea41bee64431a60b01cd036fb7e2b0cefd3023b37f3d653855
---
# HCmatinvBatched

#### 产品支持情况

| 硬件型号 | 支持情况 |
| --- | --- |
| Atlas 200I/500 A2 推理产品 | 不支持 |
| Atlas 推理系列产品 | 不支持 |
| Atlas 训练系列产品 | 不支持 |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | 支持 |
| Atlas A3 推理系列产品 / Atlas A3 训练系列产品 | 不支持 |


#### 功能描述

接口功能

- asdBlasMakeHCmatinvBatchedPlan：初始化该句柄对应的算子配置
- asdBlasHCmatinvBatched：对复数矩阵进行求逆。

计算公式

- asdBlasHCmatinvBatched的计算公式：计算批量复数矩阵的逆矩阵，每个复数矩阵需满足条件，其中A为非奇异方阵，且A是一个n*n的输入方阵，I为单位矩阵。

- 示例：
  输入“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]
```


  输入“n”为： 4

  输入“batchSize”为：2

  调用“asdBlasHCmatinvBatched”算子后，

  输出“Ainv”为：

```
[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]
```


#### 函数原型

- 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)


#### 参数说明

- asdBlasMakeHCmatinvBatchedPlan| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | 算子的句柄。 |
| n | Input | const int64\_t | 单批次矩阵A的行数。 |
| batchSize | Input | const int64\_t | 复数矩阵求逆中的矩阵数量 |


- asdBlasHCmatinvBatched| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | 算子的句柄。 |
| n | Input | const int64\_t | 单个矩阵A的行数。 |
| A | Input | aclTensor \* | 公式中的矩阵A，行主序，Device侧的Tensor，数据类型仅支持COMPLEX32，数据格式支持ND，shape为[batch, n, n]。 |
| lda | Input | const int64\_t | A左右相邻元素间的内存地址偏移量（当前约束为n）。 |
| Ainv | Output | aclTensor \* | 输出的逆矩阵，数据类型仅支持COMPLEX32，数据格式支持ND，shape为[batch, n, n] |
| lda\_inv | Input | const int64\_t | 输出的逆矩阵的左右相邻元素间的内存地址偏移量（当前约束为n） |
| info | Input | aclTensor \* | 每个batch矩阵的求逆结果信息，数据类型仅支持int32\_t，数据格式支持ND，shape为[batch, 1] |
| batchSize | Input | int64\_t | 复数矩阵求逆中的矩阵数量。 |


#### 返回值说明

返回值相关说明参见返回值。


#### 约束说明

- asdBlasMakeHCmatinvBatchedPlan：无。
- asdBlasHCmatinvBatched

  - 支持的CANN版本为CANN8.0及以上。
  - lda、lda_inv、info参数在当前版本实际未启用。
  - 输入参数n小于等于256。
  - 输入参数batchSize小于等于3000。


#### 调用示例

算子的调用示例参见HCmatinvBatched。
