量子计算 OpenFermion-Cirq 开源python库

#01 基础信息
NISQ,是嘈杂中型量子 (Noisy Intermediate-Scale Quantum) 的简称。
拥有50-100量子比特、以及高保真量子门 (Quantum Gate) 的计算机,便可称为NISQ计算机。
谷歌开源了Cirq框架,这是专为NISQ算法打造的框架。Cirq主要用来短期 (Near-Term) 问题,
帮助研究者了解NISQ计算机到底能不能解决实际应用的中的计算问题。这个框架,经Apache 2.0协议许可,可以修改,可以嵌入任何开源/付费的软件包。

框架安装好之后,开发者就可以给特定的量子处理器,编写量子算法,用户可以精确控制量子电路 (Quantum Circuits) ;更加充分地利用NISQ架构。

Cirq支持在模拟器上运行算法,如果将来有了量子计算机,或者更大的模拟器,也很容易通过云,把设备和算法集成起来。

与Cirq框架一同发布的,还有OpenFermion-Cirq,这是一个基于Cirq的应用示例。

OpenFermion是一个量子算法开发平台,专注解决化学问题。

OpenFermion-Cirq则是一个开源库,把量子模拟算法编译成Cirq能用的样子。比如,这个新库,可以用来搭建量子变分算法 (Variational Algorithms) ,模拟分子或者复杂材料的性质。

python源码:
https://github.com/quantumlib/OpenFermion-Cirq.git
https://github.com/quantumlib/Cirq.git

安装环境:跨平台。
我在win10 x64下安装正常使用。
安装方法:
参考github主页:https://github.com/quantumlib/OpenFermion-Cirq

git clone https://github.com/quantumlib/OpenFermion-Cirq
cd OpenFermion-Cirq
python -m pip install -e .

##02 安装
我在win10x64下,基于python2.7安装没成功。
后来基于python3.5.3安装成功。

D:\git\Quantum\OpenFermion-Cirq>python -m pip install -e .
Obtaining file:///D:/git/Quantum/OpenFermion-Cirq
Unknown requires Python '>=3.5.3' but the running Python is 2.7.15
You are using pip version 9.0.3, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

D:\git\Quantum\OpenFermion-Cirq>set path=C:\Python35;%path%

D:\git\Quantum\OpenFermion-Cirq>python -m pip install -e .
Obtaining file:///D:/git/Quantum/OpenFermion-Cirq
Collecting cirq==0.3.1.* (from openfermioncirq==0.2.1a35)
  Downloading https://files.pythonhosted.org/packages/dc/c9/f17b365c7ac43c6d9576d44cf894c1c42bf43ac54ef6d76f56a99b32870a/cirq-0.3.1.35-py3-none-any.whl (368kB)
    100% |████████████████████████████████| 378kB 416kB/s
Requirement already satisfied: numpy in c:\python35\lib\site-packages (from openfermioncirq==0.2.1a35)
...
...
  Found existing installation: openfermioncirq 0.2.1a27
    Can't uninstall 'openfermioncirq'. No files were found to uninstall.
  Running setup.py develop for openfermioncirq
Successfully installed Send2Trash-1.5.0 cachetools-2.1.0 certifi-2018.8.24 chardet-3.0.4 cirq-0.3.1.35 google-api-python-client-1.7.4 google-auth-1.5.1 google-auth-httplib2-0.0.3 h5py-2.8.0 httplib2-0.11.3 ipywidgets-7.4.1 jupyter-1.0.0 jupyter-client-5.2.3 jupyter-console-5.2.0 kiwisolver-1.0.1 matplotlib-2.2.3 notebook-5.6.0 openfermion-0.8.1 openfermioncirq prometheus-client-0.3.1 protobuf-3.6.1 pubchempy-1.0.4 pyasn1-modules-0.2.2 pywinpty-0.5.4 pyzmq-17.1.2 requests-2.19.1 rsa-3.4.2 sortedcontainers-2.0.5 terminado-0.8.1 uritemplate-3.0.0 urllib3-1.23 widgetsnbextension-3.4.1
You are using pip version 9.0.1, however version 18.0 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

D:\git\Quantum\OpenFermion-Cirq>

另外需要 pytest

D:\git\Quantum\OpenFermion-Cirq>pip3 install pytest

##03 运行用例

官网用例01:
https://github.com/quantumlib/OpenFermion-Cirq/blob/master/examples/tutorial_1_basis_change.ipynb

直接浏览器打开,拷贝代码到PyCharm。配置中设置为自己的python3.5.3路径。运行结果如下:
量子计算 OpenFermion-Cirq 开源python库_第1张图片

test01.py

print('01 ############################## start')
import openfermion
import numpy

# Set the number of qubits in our example.
n_qubits = 3
simulation_time = 1.
random_seed = 8317

# Generate the random one-body operator.
T = openfermion.random_hermitian_matrix(n_qubits, seed=random_seed)

# Diagonalize T and obtain basis transformation matrix (aka "u").
eigenvalues, eigenvectors = numpy.linalg.eigh(T)
basis_transformation_matrix = eigenvectors.transpose()

# Print out familiar OpenFermion "FermionOperator" form of H.
H = openfermion.FermionOperator()
for p in range(n_qubits):
    for q in range(n_qubits):
        term = ((p, 1), (q, 0))
        H += openfermion.FermionOperator(term, T[p, q])
print(H)
print('01 ############################## end')

print('02 ############################## start')
import openfermioncirq
import cirq

# Initialize the qubit register.
qubits = cirq.LineQubit.range(n_qubits)

# Start circuit with the inverse basis rotation, print out this step.
inverse_basis_rotation = cirq.inverse(openfermioncirq.bogoliubov_transform(qubits, basis_transformation_matrix))
circuit = cirq.Circuit.from_ops(inverse_basis_rotation)
print(circuit)
print('02 ############################## end')

print('03 ############################## start')
# Add diagonal phase rotations to circuit.
for k, eigenvalue in enumerate(eigenvalues):
    phase = -eigenvalue * simulation_time
    circuit.append(cirq.RotZGate(rads=phase).on(qubits[k]))

# Finally, restore basis.
basis_rotation = openfermioncirq.bogoliubov_transform(qubits, basis_transformation_matrix)
circuit.append(basis_rotation)


# Initialize a random initial state.
initial_state = openfermion.haar_random_vector(
    2 ** n_qubits, random_seed).astype(numpy.complex64)

# Numerically compute the correct circuit output.
import scipy
hamiltonian_sparse = openfermion.get_sparse_operator(H)
exact_state = scipy.sparse.linalg.expm_multiply(
    -1j * simulation_time * hamiltonian_sparse, initial_state)

# Use Cirq simulator to apply circuit.
simulator = cirq.google.XmonSimulator()
result = simulator.simulate(circuit, qubit_order=qubits,
                            initial_state=initial_state)
simulated_state = result.final_state

# Print final fidelity.
fidelity = abs(numpy.dot(simulated_state, numpy.conjugate(exact_state)))**2
print(fidelity)


xmon_circuit = cirq.google.optimized_for_xmon(circuit)
print(xmon_circuit.to_qasm())
print('03 ############################## end')

print('04 ############################## start')
xmon_circuit = cirq.google.optimized_for_xmon(circuit)
print(xmon_circuit.to_qasm())
print('04 ############################## end')

运行结果:

C:\Python35\python.exe D:/git/Quantum/OpenFermion-Cirq/examples/test01.py
01 ############################## start
(0.5367212624097257+0j) [0^ 0] +
(-0.26033703159240107+3.3259173741375454j) [0^ 1] +
(1.3433603748462144+1.544987250567917j) [0^ 2] +
(-0.26033703159240107-3.3259173741375454j) [1^ 0] +
(-2.9143303700812435+0j) [1^ 1] +
(-1.52843836446248+1.3527486791390022j) [1^ 2] +
(1.3433603748462144-1.544987250567917j) [2^ 0] +
(-1.52843836446248-1.3527486791390022j) [2^ 1] +
(2.261633626116526+0j) [2^ 2]
01 ############################## end
02 ############################## start
0: ───────────────────────────────────YXXY────────────────────Z^0.0───
                                      │
1: ─────────────YXXY────────Z^0.522───#2^-0.656───YXXY────────Z^0.0───
                │                                 │
2: ───Z^0.762───#2^-0.249─────────────Z^-0.519────#2^-0.479───Z───────
02 ############################## end
03 ############################## start
1.00000014821
// Generated from Cirq

OPENQASM 2.0;
include "qelib1.inc";


// Qubits: [0, 1, 2]
qreg q[3];


// Gate: W(0.238)^-0.5
u3(pi*0.5,pi*0.7381494354,pi*1.2618505646) q[2];

// Gate: Y^0.5
u3(pi*0.5,pi*2.0,0) q[1];

// Gate: Y^0.5
u3(pi*0.5,pi*2.0,0) q[0];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.124)^0.5
u3(pi*0.5,pi*1.6242949803,pi*0.3757050197) q[1];

// Gate: W(0.862)^0.5
u3(pi*0.5,pi*0.3624444158,pi*1.6375555842) q[2];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.249)^0.5219350773492257
u3(pi*0.5219350773,pi*1.7485899606,pi*0.2514100394) q[1];

// Gate: W(0.987)^-0.5191093380568828
u3(pi*0.5191093381,pi*1.4867393961,pi*0.5132606039) q[2];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.328)^-0.5
u3(pi*0.5,pi*0.828242091,pi*1.171757909) q[0];

// Gate: W(0.577)^-0.5
u3(pi*0.5,pi*1.0768320517,pi*0.9231679483) q[1];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.656)^-0.1172916153092598
u3(pi*0.1172916153,pi*1.156484182,pi*0.843515818) q[0];

// Gate: W(0.905)^0.5
u3(pi*0.5,pi*0.4050741427,pi*1.5949258573) q[1];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.144)^-0.5
u3(pi*0.5,pi*0.6444660692,pi*1.3555339308) q[1];

// Gate: W(0.226)^-0.5
u3(pi*0.5,pi*0.7261313226,pi*1.2738686774) q[2];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.384)^-0.3104017289871259
u3(pi*0.310401729,pi*0.8838579957,pi*1.1161420043) q[1];

// Gate: W(0.466)^-0.843806028656013
u3(pi*0.8438060287,pi*0.9655232491,pi*1.0344767509) q[2];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.623)^-0.5
u3(pi*0.5,pi*1.1232499223,pi*0.8767500777) q[1];

// Gate: W(0.705)^-0.5
u3(pi*0.5,pi*1.2049151757,pi*0.7950848243) q[2];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.863)^-0.5
u3(pi*0.5,pi*1.3626418488,pi*0.6373581512) q[1];

// Gate: W(0.944)^-0.5191093380568828
u3(pi*0.5191093381,pi*1.4443071022,pi*0.5556928978) q[2];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.985)^0.5
u3(pi*0.5,pi*0.4847262731,pi*1.5152737269) q[0];

// Gate: W(0.191)^0.5
u3(pi*0.5,pi*1.6908839398,pi*0.3091160602) q[1];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.813)^0.5
u3(pi*0.5,pi*0.3129683641,pi*1.6870316359) q[0];

// Gate: W(0.519)^0.47806492265077405
u3(pi*0.4780649227,pi*0.0191260308,pi*1.9808739692) q[1];

rz(pi*0.6870316359) q[0];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.643)^-0.5
u3(pi*0.5,pi*1.1434210112,pi*0.8565789888) q[1];

// Gate: W(0.0686)^-0.5
u3(pi*0.5,pi*0.5686020825,pi*1.4313979175) q[2];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.268)^0.5
u3(pi*0.5,pi*1.7677159915,pi*0.2322840085) q[1];

// Gate: W(0.693)^-0.5
u3(pi*0.5,pi*1.1928970628,pi*0.8071029372) q[2];

rz(pi*-0.4547476274) q[2];
rz(pi*-0.7677159915) q[1];

03 ############################## end
04 ############################## start
// Generated from Cirq

OPENQASM 2.0;
include "qelib1.inc";


// Qubits: [0, 1, 2]
qreg q[3];


// Gate: W(0.238)^-0.5
u3(pi*0.5,pi*0.7381494354,pi*1.2618505646) q[2];

// Gate: Y^0.5
u3(pi*0.5,pi*2.0,0) q[1];

// Gate: Y^0.5
u3(pi*0.5,pi*2.0,0) q[0];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.124)^0.5
u3(pi*0.5,pi*1.6242949803,pi*0.3757050197) q[1];

// Gate: W(0.862)^0.5
u3(pi*0.5,pi*0.3624444158,pi*1.6375555842) q[2];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.249)^0.5219350773492257
u3(pi*0.5219350773,pi*1.7485899606,pi*0.2514100394) q[1];

// Gate: W(0.987)^-0.5191093380568828
u3(pi*0.5191093381,pi*1.4867393961,pi*0.5132606039) q[2];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.328)^-0.5
u3(pi*0.5,pi*0.828242091,pi*1.171757909) q[0];

// Gate: W(0.577)^-0.5
u3(pi*0.5,pi*1.0768320517,pi*0.9231679483) q[1];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.656)^-0.1172916153092598
u3(pi*0.1172916153,pi*1.156484182,pi*0.843515818) q[0];

// Gate: W(0.905)^0.5
u3(pi*0.5,pi*0.4050741427,pi*1.5949258573) q[1];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.144)^-0.5
u3(pi*0.5,pi*0.6444660692,pi*1.3555339308) q[1];

// Gate: W(0.226)^-0.5
u3(pi*0.5,pi*0.7261313226,pi*1.2738686774) q[2];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.384)^-0.3104017289871259
u3(pi*0.310401729,pi*0.8838579957,pi*1.1161420043) q[1];

// Gate: W(0.466)^-0.843806028656013
u3(pi*0.8438060287,pi*0.9655232491,pi*1.0344767509) q[2];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.623)^-0.5
u3(pi*0.5,pi*1.1232499223,pi*0.8767500777) q[1];

// Gate: W(0.705)^-0.5
u3(pi*0.5,pi*1.2049151757,pi*0.7950848243) q[2];

// Gate: Exp11Gate(half_turns=0.47878385305425208)
u3(pi*0.5,pi*1.0,pi*1.25) q[1];
u3(pi*0.5,pi*1.0,pi*0.75) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.2606080735) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*1.9893919265,0) q[1];
u3(pi*0.5,pi*0.4893919265,0) q[2];

// Gate: W(0.863)^-0.5
u3(pi*0.5,pi*1.3626418488,pi*0.6373581512) q[1];

// Gate: W(0.944)^-0.5191093380568828
u3(pi*0.5191093381,pi*1.4443071022,pi*0.5556928978) q[2];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.985)^0.5
u3(pi*0.5,pi*0.4847262731,pi*1.5152737269) q[0];

// Gate: W(0.191)^0.5
u3(pi*0.5,pi*1.6908839398,pi*0.3091160602) q[1];

// Gate: Exp11Gate(half_turns=0.65648418204460857)
u3(pi*0.5,0,pi*1.4262081912) q[0];
u3(pi*0.5,0,pi*0.9262081912) q[1];
rx(pi*0.5) q[0];
cx q[0],q[1];
rx(pi*0.171757909) q[0];
ry(pi*0.5) q[1];
cx q[1],q[0];
rx(pi*-0.5) q[1];
rz(pi*0.5) q[1];
cx q[0],q[1];
u3(pi*0.5,pi*1.9020338998,pi*1.0) q[0];
u3(pi*0.5,pi*0.4020338998,pi*1.0) q[1];

// Gate: W(0.813)^0.5
u3(pi*0.5,pi*0.3129683641,pi*1.6870316359) q[0];

// Gate: W(0.519)^0.47806492265077405
u3(pi*0.4780649227,pi*0.0191260308,pi*1.9808739692) q[1];

rz(pi*0.6870316359) q[0];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.643)^-0.5
u3(pi*0.5,pi*1.1434210112,pi*0.8565789888) q[1];

// Gate: W(0.0686)^-0.5
u3(pi*0.5,pi*0.5686020825,pi*1.4313979175) q[2];

// Gate: Exp11Gate(half_turns=0.24858996064554528)
u3(pi*0.5,pi*1.0,pi*0.75) q[1];
u3(pi*0.5,pi*1.0,pi*0.25) q[2];
rx(pi*0.5) q[1];
cx q[1],q[2];
rx(pi*0.3757050197) q[1];
ry(pi*0.5) q[2];
cx q[2],q[1];
rx(pi*-0.5) q[2];
rz(pi*0.5) q[2];
cx q[1],q[2];
u3(pi*0.5,pi*0.3742949803,0) q[1];
u3(pi*0.5,pi*0.8742949803,0) q[2];

// Gate: W(0.268)^0.5
u3(pi*0.5,pi*1.7677159915,pi*0.2322840085) q[1];

// Gate: W(0.693)^-0.5
u3(pi*0.5,pi*1.1928970628,pi*0.8071029372) q[2];

rz(pi*-0.4547476274) q[2];
rz(pi*-0.7677159915) q[1];

04 ############################## end

你可能感兴趣的:(量子计算)