You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
574 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

参照作业图容易实现QFT算法代码见QFT.cpp
`QuantumFT`函数接收一个`Qvec`参数为需要计算QFT的量子比特向量返回对其进行QFT的量子线路
值得注意的是按照QFT的定义最后需要逆转量子比特的顺序而图中没有给出
对于3个量子比特的情形对应的Origin IR代码如下
```
QINIT 3
CREG 0
H q[0]
CR q[1],q[0],(1.5707963)
CR q[2],q[0],(0.78539816)
H q[1]
CR q[2],q[1],(1.5707963)
H q[2]
SWAP q[0],q[2]
```
该量子线路对应的矩阵如下,可以验证其正确性
![](QFT_mat.PNG)