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

#### 产品支持情况

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


#### 功能描述

接口功能

- asdBlasMakeRotPlan：初始化该句柄对应的Csrot算子配置。
- asdBlasCsrot：对输入复向量组（x，y）进行旋转。

计算公式

- asdBlasCsrot的计算公式：
  其中c为旋转角度余弦值，s为旋转角度正弦值，x和y是复数向量。


- 示例：
  输入“x”为：

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


  输入“y”为：

```
[1.0 + 1.0j, 3.0 + 3.0j]
```


  输入“c”为：

  输入“s”为：0.5

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

```
[3.098076+3.9641016j, 3.232051+2.3660254j]
```


  输出“y”为：

```
[-0.6339746-1.1339746j, 1.5980761+2.098076j]
```


#### 函数原型

- AspbStatus asdBlasMakeRotPlan(asdBlasHandle handle)
- AspbStatus asdBlasCsrot(asdBlasHandle handle, const int64_t n, aclTensor *x, const int64_t incx, aclTensor *y,const int64_t incy, const float *c, const float *s)


#### 参数说明

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


- asdBlasCsrot| 参数名称 | Input/Output | 类型 | 描述 |
| --- | --- | --- | --- |
| handle | Input | asdBlasHandle | csrot算子的句柄。 |
| n | Input | const int64\_t | 向量中复数元素的个数。 |
| x | Input/Output | aclTensor \* | 公式中的x，Device侧的Tensor，数据类型支持COMPLEX64，数据格式支持ND，shape为[n]。 |
| incx | Input | const int64\_t | x相邻元素间的内存地址偏移量（当前约束为1）。 |
| y | Input/Output | aclTensor \* | 公式中的y，Device侧的Tensor，数据类型支持COMPLEX64，数据格式支持ND，shape为[n]。 |
| incy | Input | const int64\_t | y相邻元素间的内存地址偏移量（当前约束为1）。 |
| c | Input | const float \* | 旋转矩阵的余弦值指针。 |
| s | Input | const float \* | 旋转矩阵的正弦值指针。 |


#### 返回值说明

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


#### 约束说明

- asdBlasMakeRotPlan：无。
- asdBlasCsrot

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


#### 调用示例

算子的调用示例参见Csrot。
