Skip to content

Commit aca804b

Browse files
author
Zhuoyang Ye
committed
[Design] Design params and structure according to qiskit.
1 parent fb645b9 commit aca804b

File tree

2 files changed

+63
-55
lines changed

2 files changed

+63
-55
lines changed

torchquantum/noise_model/noise_channel.py

+4
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ def __init__(self):
4242
def add_all_qubit_error(self):
4343
pass
4444

45+
46+
def add_quantum_error(self):
47+
pass
48+

torchquantum/noise_model/quantum_errors.py

+59-55
Original file line numberDiff line numberDiff line change
@@ -25,131 +25,143 @@
2525
import numpy as np
2626
import torch
2727
import torchquantum as tq
28+
from __future__ import annotations
2829

2930

3031
class QuantumError(object):
3132
"""
3233
A class for describing quantum error
3334
34-
Methods:
35+
"""
3536

37+
def __init__(self):
38+
pass
3639

37-
"""
38-
def __init__(self,
39-
wires):
40+
def compose(self, other: QuantumError) -> QuantumError:
4041
pass
4142

43+
def tensor(self, other: QuantumError) -> QuantumError:
44+
pass
4245

46+
def expand(self, other: QuantumError) -> QuantumError:
47+
pass
4348

44-
class KrausError(QuantumError):
45-
"""
46-
A class for describing quantum error
4749

48-
Methods:
50+
class krausError(QuantumError):
51+
"""
52+
A general CPTP quantum error given a list of kraus matrices
4953
54+
Params:
5055
5156
"""
57+
5258
def __init__(self,
5359
wires):
5460
pass
5561

5662

57-
5863
class mixed_unitary_error(QuantumError):
5964
"""
60-
A class for describing quantum error
61-
62-
Methods:
65+
An n-qubit mixed unitary error
6366
67+
Params:
6468
6569
"""
70+
6671
def __init__(self,
6772
wires):
6873
pass
6974

7075

7176
class coherent_unitary_error(QuantumError):
7277
"""
73-
A class for describing quantum error
74-
75-
Methods:
76-
78+
An n qubit coheren error given a a single unitary
7779
80+
Params:
7881
"""
7982

8083
def __init__(self,
8184
wires):
8285
pass
8386

8487

85-
86-
8788
class pauli_error(QuantumError):
8889
"""
89-
A class for describing quantum error
90+
An n qubit pauli error channel
91+
Initialized from a list of paulis and probability.
9092
91-
Methods:
93+
Params:
9294
95+
[(P0,p0),(P1,p1),...]
9396
9497
"""
9598

9699
def __init__(self,
97-
wires):
100+
oplist):
98101
pass
99102

100103

101-
102104
class depolarizing_error(QuantumError):
103105
"""
104-
A class for describing quantum error
106+
An n qubit depolarizing error channel
105107
106-
Methods:
108+
Params:
107109
110+
Depolarization probability p
108111
109112
"""
110113

111114
def __init__(self,
112-
wires):
115+
p):
113116
pass
114117

115118

116-
117119
class reset_error(QuantumError):
118120
"""
119-
A class for describing quantum error
120-
121-
Methods:
121+
A single qubit reset error
122122
123+
Params:
124+
p0: Resetting of |0> state
125+
p1: Resetting of |1> state
123126
124127
"""
125128

126129
def __init__(self,
127-
wires):
130+
p0,
131+
p1):
128132
pass
129133

130134

131-
132135
class thermal_relaxation_error(QuantumError):
133136
"""
134-
A class for describing quantum error
135-
136-
Methods:
137-
138-
137+
A single qubit thermal relaxation channel.
138+
The relaxation process is determined by T1 and T2, gate time t,
139+
and excited state thermal population p1
140+
Params:
141+
T1: Depolarization time
142+
T2: Dephasing time
143+
t: gate time
144+
p1: excited state thermal population p1
139145
"""
140146

141147
def __init__(self,
142-
wires):
148+
T1,
149+
T2,
150+
t,
151+
p1):
143152
pass
144153

145154

146-
147155
class phase_amplitude_damping_error(QuantumError):
148156
"""
149-
A class for describing quantum error
157+
A single qubit generalized combined phase and
158+
amplitude damping.
150159
151-
Methods:
160+
Params:
152161
162+
lambda: Amplitude damping parameter
163+
gamma: Phase damping parameter
164+
p1: excited state thermal population p1
153165
154166
"""
155167

@@ -160,10 +172,12 @@ def __init__(self,
160172

161173
class amplitude_damping_error(QuantumError):
162174
"""
163-
A class for describing quantum error
175+
A class for describing amplitude damping
164176
165-
Methods:
177+
Params:
166178
179+
lambda: Amplitude damping parameter
180+
p1: excited state thermal population p1
167181
168182
"""
169183

@@ -172,27 +186,17 @@ def __init__(self,
172186
pass
173187

174188

175-
176189
class phase_damping_error(QuantumError):
177190
"""
178191
A class for describing quantum error
179192
180-
Methods:
193+
Params:
181194
195+
gamma: Phase damping parameter
196+
p1: excited state thermal population p1
182197
183198
"""
184199

185200
def __init__(self,
186201
wires):
187202
pass
188-
189-
190-
191-
192-
193-
194-
195-
196-
197-
198-

0 commit comments

Comments
 (0)