-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtoric_code_mixed.py
More file actions
20 lines (16 loc) · 832 Bytes
/
toric_code_mixed.py
File metadata and controls
20 lines (16 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from qiskit import QuantumRegister, QuantumCircuit, ClassicalRegister
class ToricCodeMixed:
def __init__(self, x, y, classical_bit_count=4, ancillas_count=0):
"""
:param x: Column count. In case of matching boundary condition even rows has one less qubit
:param y: Row count
:param classical_bit_count: Number of classical bits
"""
self.x, self.y = x, y
self.plaquette_x, self.plaquette_y = self.x // 2 - 1, self.y + 2
self.star_x, self.star_y = self.x - self.plaquette_x, self.y
# first coordinate is row index, second is column index
self.regs = [QuantumRegister(self.x, f'l{lev}') for lev in range(self.y)]
self.c_reg = ClassicalRegister(classical_bit_count)
self.circ = QuantumCircuit(*self.regs, self.c_reg)
# TODO