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

#### 产品支持情况

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


#### 功能说明

接口功能：

- asdBlasMakeCaxpyPlan：初始化该句柄对应的Caxpy算子配置。
- asdBlasCaxpy：实现复数向量乘以一个复数标量后，再加上一个复数向量。

计算公式：

- asdBlasCaxpy的计算公式：
- 示例：
  输入“x”为：

```
[3.0 + 4.0j, 4.0 + 4.0j]
```


  输入“alpha”为：

```
3.0 + 4.0j
```


  输入“y”为：

```
[3.0 + 4.0j, 4.0 + 4.0j]
```


  调用“Caxpy”算子后，

  输出“y”为：

```
[-4.0 + 28.0j, 0.0 + 32.0j]
```


#### 函数原型

- AspbStatus asdBlasMakeCaxpyPlan(asdBlasHandle handle)
- AspbStatus asdBlasCaxpy(asdBlasHandle handle, const int64_t n, const std::complex<float> *alpha, aclTensor* x,int64_t incx, aclTensor* y, int64_t incy)


#### 参数说明

- asdBlasMakeCaxpyPlan| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | Caxpy算子的句柄。 |


- asdBlasCaxpy| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | Caxpy算子的句柄。 |
| n | Input | const int64\_t | 向量中复数元素的个数。 |
| alpha | Input | const std::complex<float> \* | 公式中的alpha，输入的复数标量，数据类型支持COMPLEX64。 |
| x | Input | aclTensor\* | 公式中的x，Device侧的Tensor，数据类型支持COMPLEX64，数据格式支持ND，shape为[n]。 |
| incx | Input | int64\_t | 向量x相邻元素间的内存地址偏移量（当前约束为1）。 |
| y | Input/Output | aclTensor\* | 公式中的y，Device侧的Tensor，数据类型支持COMPLEX64，数据格式支持ND，shape为[n]。 |
| incy | Input | int64\_t | 向量y相邻元素间的内存地址偏移量（当前约束为1）。 |


#### 返回值说明

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


#### 约束说明

- asdBlasMakeCaxpyPlan：无。
- asdBlasCaxpy

  - 输入的元素个数n当前覆盖支持[1，6.71e+06]。
  - 算子输入shape为[n]、[n]，输出shape为[n]。

  - 算子实际计算时，不支持ND高维度运算（不支持维度≥3的运算）。


#### 调用示例

算子的调用示例参见Caxpy。
