-
Notifications
You must be signed in to change notification settings - Fork 6
/
stabilizer_check_matrices.py
74 lines (65 loc) · 2.07 KB
/
stabilizer_check_matrices.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
import numpy as np
mat_dict = {}
# dtype = np.uint instead of bool so that addition works correctly
# the second element of list stores a dict showing the types of errors the
# code can correct and number of those errors: 'X', 'Y', 'Z' are the standard
# stuff. The min of these three is the number of arbitrary qubit errors the
# code can handle. Other than that we also mention 'XZ' which means one X and
# one Z occuring on different qubits (Shor and Steane codes can correct this).
mat_dict['bit_flip_code'] = [np.array([
[0, 0, 0, 1, 1, 0],
[0, 0, 0, 1, 0, 1],
], dtype = np.uint), {
'X': 1,
'Z': 0,
'Y': 0,
'XZ': 0,
}]
mat_dict['phase_flip_code'] = [np.array([
[1, 1, 0, 0, 0, 0],
[1, 0, 1, 0, 0, 0],
], dtype = np.uint), {
'X': 0,
'Z': 1,
'Y': 0,
'XZ': 0,
}]
mat_dict['shor_code'] = [np.array([
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1],
[1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
], dtype = np.uint), {
'X': 1,
'Z': 1,
'Y': 1,
'XZ': 1,
}]
mat_dict['steane_code'] = [np.array([
[1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
[1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0],
[0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1],
], dtype = np.uint), {
'X': 1,
'Z': 1,
'Y': 1,
'XZ': 1,
}]
mat_dict['five_qubit_code'] = [np.array([
[1, 0, 0, 1, 0, 0, 1, 1, 0, 0],
[0, 1, 0, 0, 1, 0, 0, 1, 1, 0],
[1, 0, 1, 0, 0, 0, 0, 0, 1, 1],
[0, 1, 0, 1, 0, 1, 0, 0, 0, 1],
], dtype = np.uint), {
'X': 1,
'Z': 1,
'Y': 1,
'XZ': 0,
}]