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

#### 产品支持情况

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


#### 功能描述

接口功能

- asdBlasMakeStrmvPlan
  接口功能：初始化该句柄对应的Strmv算子配置。


- asdBlasStrmv
  接口功能：单精度，用于计算一个三角矩阵与一个向量的矩阵乘法。


计算公式

- asdBlasStrmv的计算公式

  - 矩阵向量乘积：
  - 转置矩阵向量乘积：
- 示例：
  输入“A”为：

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


  输入“x”为：

```
[1,2]
```


  输入“uplo”为：U，输入“trans”为：T，输入“diag”为：N。

  输入“n”为：2，输入“lda”为：2，输入“incx”为：1。

  调用“Strmv”算子后，输出“x”为：

```
[7,10]
```


#### 函数原型

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


#### 参数说明

- asdBlasMakeStrmvPlan| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | Strmv算子的句柄。 |
| uplo | Input | asdBlasFillMode\_t | 指定矩阵A的存储方式。 ASDBLAS\_FILL\_MODE\_LOWER // 下三角 ASDBLAS\_FILL\_MODE\_UPPER // 上三角 |
| trans | Input | asdBlasOperation\_t | 指定是否对矩阵A进行转置。 ASDBLAS\_OP\_N // 不转置 ASDBLAS\_OP\_T // 转置 |
| n | Input | int64\_t | 矩阵A的行数和列数，向量x的元素个数。 |


- asdBlasStrmv| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | strmv算子的句柄。 |
| uplo | Input | asdBlasFillMode\_t | 指定矩阵A的存储方式。 ASDBLAS\_FILL\_MODE\_LOWER // 下三角 ASDBLAS\_FILL\_MODE\_UPPER // 上三角 |
| trans | Input | asdBlasOperation\_t | 指定是否对矩阵A进行转置。 ASDBLAS\_OP\_N // 不转置 ASDBLAS\_OP\_T // 转置 |
| diag | Input | asdBlasDiagType\_t | 指定是否假定矩阵A的对角线元素为1。 ASDBLAS\_DIAG\_NON\_UNIT // 不假定为1 ASDBLAS\_DIAG\_UNIT // 假定为1 |
| n | Input | const int64\_t | 矩阵A的行数和列数，向量x的元素个数。 |
| A | Input | aclTensor\* | 公式中的A，Device侧的Tensor，数据类型仅支持FLOAT32，数据格式支持ND，shape为[n，n]。 |
| lda | Input | const int64\_t | 表示张量A中元素的间隔。 |
| x | Input/Output | aclTensor\* | 公式中的x，Device侧的Tensor，数据类型仅支持FLOAT32，数据格式支持ND，shape为[n]。 |
| incx | Input | const int64\_t | 表示向量x中元素的间隔。 |


#### 返回值说明

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


#### 约束说明

- asdBlasMakeStrmvPlan：无。

- asdBlasStrmv

  - 输入的元素个数n当前覆盖支持[1，8192]。
  - 算子输入shape为[n，n]、[n]，输出shape为[n]。
  - 算子实际计算时，不支持ND高维度运算（不支持维度≥3的运算）。


#### 调用示例

算子的调用示例参见Strmv。
