-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_encoding.py
179 lines (165 loc) · 12.8 KB
/
main_encoding.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
"""Code in this file is used for determining encoding fidelity, with a variety
of setups. Generates Table 4.2
"""
# %% Import modules
import numpy as np
from qiskit import *
# Our own files
from simulator_program.custom_noise_models import WACQT_target_times
from simulator_program.data_analysis_tools import *
# %%
# Full connectivity
fid_0_FC, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ')
fid_1_FC, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ')
fid_p_FC, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ')
fid_m_FC, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ')
# Hexagonal, with iSWAP
fid_0_hex, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
fid_1_hex, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
fid_p_hex, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
fid_m_hex, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
# Hexagonal, no iSWAP
fid_0_hex_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
fid_1_hex_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
fid_p_hex_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
fid_m_hex_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ')
# Double diamond, with iSWAP
fid_0_DD, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
fid_1_DD, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
fid_p_DD, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
fid_m_DD, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
# Double diamond, no iSWAP
fid_0_DD_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
fid_1_DD_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
fid_p_DD_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
fid_m_DD_cz, _, _ = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ')
#%%
print(*[np.round(f,3) for f in [fid_0_FC,fid_1_FC,fid_p_FC,fid_m_FC]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_hex,fid_1_hex,fid_p_hex,fid_m_hex]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_hex_cz,fid_1_hex_cz,fid_p_hex_cz,fid_m_hex_cz]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_DD,fid_1_DD,fid_p_DD,fid_m_DD]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_DD_cz,fid_1_DD_cz,fid_p_DD_cz,fid_m_DD_cz]],sep=' & ')
#%% Projected
project = True
# Full connectivity
fid_0_FC, _, _, P_L_0_FC = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ',project=project)
fid_1_FC, _, _, P_L_1_FC = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ',project=project)
fid_p_FC, _, _, P_L_p_FC = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ',project=project)
fid_m_FC, _, _, P_L_m_FC = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=True,
snapshot_type='dm', device=None, pauliop='ZZZZZ',project=project)
# Hexagonal, with iSWAP
fid_0_hex, _, _, P_L_0_hex = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
fid_1_hex, _, _, P_L_1_hex = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
fid_p_hex, _, _, P_L_p_hex = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
fid_m_hex, _, _, P_L_m_hex = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=True,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
# Hexagonal, no iSWAP
fid_0_hex_cz, _, _, P_L_0_hex_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
fid_1_hex_cz, _, _, P_L_1_hex_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
fid_p_hex_cz, _, _, P_L_p_hex_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
fid_m_hex_cz, _, _, P_L_m_hex_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
# Double diamond, with iSWAP
fid_0_DD, _, _, P_L_0_DD = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
fid_1_DD, _, _, P_L_1_DD = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
fid_p_DD, _, _, P_L_p_DD = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
fid_m_DD, _, _, P_L_m_DD = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=True,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
# Double diamond, no iSWAP
fid_0_DD_cz, _, _, P_L_0_DD_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
fid_1_DD_cz, _, _, P_L_1_DD_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi, phi=0, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
fid_p_DD_cz, _, _, P_L_p_DD_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=0, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
fid_m_DD_cz, _, _, P_L_m_DD_cz = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=np.pi/2, phi=np.pi, iswap=False,
snapshot_type='dm', device='DD', pauliop='ZZZZZ',project=project)
#%% F_L
print(*[np.round(f,3) for f in [fid_0_FC,fid_1_FC,fid_p_FC,fid_m_FC]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_hex,fid_1_hex,fid_p_hex,fid_m_hex]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_hex_cz,fid_1_hex_cz,fid_p_hex_cz,fid_m_hex_cz]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_DD,fid_1_DD,fid_p_DD,fid_m_DD]],sep=' & ')
print(*[np.round(f,3) for f in [fid_0_DD_cz,fid_1_DD_cz,fid_p_DD_cz,fid_m_DD_cz]],sep=' & ')
#%% P_L
print(*[np.round(np.real(f),3) for f in [P_L_0_FC,P_L_1_FC,P_L_p_FC,P_L_m_FC]],sep=' & ')
print(*[np.round(np.real(f),3) for f in [P_L_0_hex,P_L_1_hex,P_L_p_hex,P_L_m_hex]],sep=' & ')
print(*[np.round(np.real(f),3) for f in [P_L_0_hex_cz,P_L_1_hex_cz,P_L_p_hex_cz,P_L_m_hex_cz]],sep=' & ')
print(*[np.round(np.real(f),3) for f in [P_L_0_DD,P_L_1_DD,P_L_p_DD,P_L_m_DD]],sep=' & ')
print(*[np.round(np.real(f),3) for f in [P_L_0_DD_cz,P_L_1_DD_cz,P_L_p_DD_cz,P_L_m_DD_cz]],sep=' & ')
# %%
fid_0_hex_cz, _, _, P_L = encoding_fidelity(1, gate_times=WACQT_target_times, T1=40e3, T2=60e3,
idle_noise=True, theta=0, phi=0, iswap=False,
snapshot_type='dm', device='WACQT', pauliop='ZZZZZ',project=project)
# %%