The Quantum Exact Simulation Toolkit v4.2.0
Loading...
Searching...
No Matches
decoherence.h
1/** @file
2 * API signatures for effecting decohering channels upon Quregs
3 * which are instantiated as density matrices.
4 *
5 * @author Tyson Jones
6 *
7 * @defgroup decoherence Decoherence
8 * @ingroup api
9 * @brief Functions for effecting decoherence channels upon density matrices.
10 * @{
11 */
12
13#ifndef DECOHERENCE_H
14#define DECOHERENCE_H
15
16#include "quest/include/types.h"
17#include "quest/include/qureg.h"
18#include "quest/include/channels.h"
19
20
21
22/*
23 * C AND C++ AGNOSTIC FUNCTIONS
24 */
25
26// enable invocation by both C and C++ binaries
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31
32/** @notyetdoced
33 *
34 * @formulae
35 *
36 * Let @f$ \dmrho = @f$ @p qureg, @f$ p = @f$ @p prob and @f$ t = @f$ @p target.
37 *
38 * This function effects
39 * @f[
40 \dmrho
41 \;\rightarrow\;
42 (1 - p) \, \dmrho
43 \,+\,
44 p \, \hat{Z}_t \,\dmrho\, \hat{Z}_t.
45 * @f]
46 *
47 * @equivalences
48 *
49 * This function is equivalent to (but much faster than):
50 * - mixPaulis() with a zero probability for the @f$\hat{X}@f$ and @f$\hat{Y}@f$ components.
51 * ```
52 mixPaulis(qureg, target, 0, 0, prob);
53 * ```
54 * - mixKrausMap() with (scaled) @f$\hat{\id}@f$ and @f$\hat{Z}@f$ Kraus operators.
55 * ```
56 qreal a = sqrt(1-prob);
57 qreal b = sqrt(prob);
58
59 KrausMap map = createInlineKrausMap(1, 2, {
60 {{a,0},{0, a}}, // a * I
61 {{b,0},{0,-b}} // b * Z
62 });
63
64 mixKrausMap(qureg, &target, 1, map);
65 * ```
66 * - mixQureg() with a duplicated Qureg modified under applyPauliZ().
67 * ```
68 Qureg clone = createCloneQureg(qureg);
69 applyPauliZ(clone);
70 mixQureg(qureg, other, prob);
71 * ```
72 *
73 * @notyetvalidated
74 */
75void mixDephasing(Qureg qureg, int target, qreal prob);
76
77
78/** @notyetdoced
79 *
80 * @formulae
81 *
82 * Let @f$ \dmrho = @f$ @p qureg, @f$ p = @f$ @p prob, @f$ t_1 = @f$ @p target1 and @f$ t_2 = @f$ @p target2.
83 *
84 * This function effects
85 * @f[
86 \dmrho
87 \;\rightarrow\;
88 (1 - p) \, \dmrho
89 \,+\,
90 \frac{p}{3} \left(
91 \hat{Z}_{t_1} \dmrho \hat{Z}_{t_1}
92 \,+\,
93 \hat{Z}_{t_1} \dmrho \hat{Z}_{t_1}
94 \,+\,
95 \hat{Z}_{t_1} \hat{Z}_{t_2} \dmrho \hat{Z}_{t_1} \hat{Z}_{t_2}
96 \right).
97 * @f]
98 *
99 * @equivalences
100 *
101 * This function is equivalent to (but much faster than):
102 * - mixKrausMap() with (scaled) @f$\hat{\id}\otimes\hat{\id}@f$, @f$\hat{\id}\otimes\hat{Z}@f$,
103 * @f$\hat{Z}\otimes\hat{\id}@f$ and @f$\hat{Z}\otimes\hat{Z}@f$ Kraus operators.
104 * ```
105 qreal a = sqrt(1-prob);
106 qreal b = sqrt(prob/3);
107
108 KrausMap map = createInlineKrausMap(2, 4, {
109 {{a,0,0,0},{0, a,0,0},{0,0, a,0},{0,0,0, a}}, // a * II
110 {{b,0,0,0},{0,-b,0,0},{0,0, b,0},{0,0,0,-b}}, // b * IZ
111 {{b,0,0,0},{0, b,0,0},{0,0,-b,0},{0,0,0,-b}}, // b * ZI
112 {{b,0,0,0},{0,-b,0,0},{0,0,-b,0},{0,0,0, b}} // b * ZZ
113 });
114
115 int targets[] = {target1, target2};
116 mixKrausMap(qureg, targets, 2, map);
117 * ```
118 *
119 * @notyetvalidated
120 */
121void mixTwoQubitDephasing(Qureg qureg, int target1, int target2, qreal prob);
122
123
124/** @notyetdoced
125 *
126 * @formulae
127 *
128 * Let @f$ \dmrho = @f$ @p qureg, @f$ p = @f$ @p prob and @f$ t = @f$ @p target.
129 *
130 * This function effects
131 * @f[
132 \dmrho \;\rightarrow\;
133 (1 - p) \, \dmrho \,+\, \frac{p}{3} \left(
134 \hat{X}_t \dmrho \hat{X}_t \,+\,
135 \hat{Y}_t \dmrho \hat{Y}_t \,+\,
136 \hat{Z}_t \dmrho \hat{Z}_t
137 \right).
138 * @f]
139 *
140 * @equivalences
141 *
142 * This function is equivalent to (but much faster than):
143 * - mixPaulis() with a uniform probability.
144 * ```
145 mixPaulis(qureg, target, prob/3, prob/3, prob/3);
146 * ```
147 * - mixKrausMap() with (scaled) @f$\hat{\id}@f$, @f$\hat{X}@f$, @f$\hat{Y}@f$ and @f$\hat{Z}@f$ Kraus operators.
148 * ```
149 qreal a = sqrt(1-prob);
150 qreal b = sqrt(prob/3);
151
152 KrausMap map = createInlineKrausMap(1, 4, {
153 {{a,0},{0, a}}, // a * I
154 {{0,b},{b, 0}}, // b * X
155 {{b,0},{0,-b}} // b * Z
156 {{0,-1i*b},{1i*b,0}}, // b * Y
157 });
158
159 mixKrausMap(qureg, &target, 1, map);
160 * ```
161 *
162 * @notyetvalidated
163 */
164void mixDepolarising(Qureg qureg, int target, qreal prob);
165
166
167/** @notyetdoced
168 *
169 * @formulae
170 *
171 * Let @f$ \dmrho = @f$ @p qureg, @f$ p = @f$ @p prob, @f$ t_1 = @f$ @p target1 and @f$ t_2 = @f$ @p target2.
172 *
173 * This function effects:
174 * @f[
175 \dmrho \; \rightarrow \;
176 (1 - p) \dmrho
177 +
178 \frac{p}{15} \left(
179 \sum_{\hat{\sigma} \in \{\hat{\id},\hat{X},\hat{Y},\hat{Z}\}}
180 \sum_{\hat{\sigma}' \in \{\hat{\id},\hat{X},\hat{Y},\hat{Z}\}}
181 \hat{\sigma}_{t_1} \hat{\sigma}_{t_2}'
182 \; \dmrho \;
183 \hat{\sigma}_{t_1} \hat{\sigma}_{t_2}'
184 \right)
185 - \frac{p}{15} \hat{\id}_{t_1} \hat{\id}_{t_2} \dmrho \hat{\id}_{t_1} \hat{\id}_{t_2},
186 * @f]
187 *
188 * or verbosely:
189 *
190 * @f[
191 \dmrho \; \rightarrow \;
192 (1 - p) \, \rho + \frac{p}{15} \;
193 \left(
194 \begin{gathered}
195 \hat{X}_{t_1} \, \rho \, \hat{X}_{t_1} +
196 \hat{Y}_{t_1} \, \rho \, \hat{Y}_{t_1} +
197 \hat{Z}_{t_1} \, \rho \, \hat{Z}_{t_1} +
198 \\
199 \hat{X}_{t_2} \, \rho \, \hat{X}_{t_2} +
200 \hat{Y}_{t_2} \, \rho \, \hat{Y}_{t_2} +
201 \hat{Z}_{t_2} \, \rho \, \hat{Z}_{t_2} +
202 \\
203 \hat{X}_{t_1} \hat{X}_{t_2} \, \rho \, \hat{X}_{t_1} \hat{X}_{t_2} +
204 \hat{Y}_{t_1} \hat{Y}_{t_2} \, \rho \, \hat{Y}_{t_1} \hat{Y}_{t_2} +
205 \hat{Z}_{t_1} \hat{Z}_{t_2} \, \rho \, \hat{Z}_{t_1} \hat{Z}_{t_2} +
206 \\
207 \hat{X}_{t_1} \hat{Y}_{t_2} \, \rho \, \hat{X}_{t_1} \hat{Y}_{t_2} +
208 \hat{Y}_{t_1} \hat{Z}_{t_2} \, \rho \, \hat{Y}_{t_1} \hat{Z}_{t_2} +
209 \hat{Z}_{t_1} \hat{X}_{t_2} \, \rho \, \hat{Z}_{t_1} \hat{X}_{t_2} +
210 \\
211 \hat{X}_{t_1} \hat{Z}_{t_2} \, \rho \, \hat{X}_{t_1} \hat{Z}_{t_2} +
212 \hat{Y}_{t_1} \hat{X}_{t_2} \, \rho \, \hat{Y}_{t_1} \hat{Z}_{t_2} +
213 \hat{Z}_{t_1} \hat{Y}_{t_2} \, \rho \, \hat{Z}_{t_1} \hat{Y}_{t_2}
214 \end{gathered}
215 \right).
216 * @f]
217 *
218 * @equivalences
219 *
220 * This function is equivalent to (but much faster than):
221 * - mixKrausMap() with Kraus operators containing every possible tensor product
222 * of two Pauli matrices, all scaled by @f$ (p/15)^{1/2} @f$, _except_ for
223 * @f$ \hat{\id} \otimes \hat{\id} @f$ which is scaled by @f$ (1-16p/15)^{1/2} @f$.
224 *
225 * @notyetvalidated
226 */
227void mixTwoQubitDepolarising(Qureg qureg, int target1, int target2, qreal prob);
228
229
230/** @notyetdoced
231 *
232 * @formulae
233 *
234 * Let @f$ \dmrho = @f$ @p qureg, @f$ p = @f$ @p prob and @f$ t = @f$ @p target.
235 *
236 * This function effects
237 * @f[
238 \dmrho \; \rightarrow \;
239 \hat{K}_t^{(1)} \dmrho \, {\hat{K}_t^{(2)}}^\dagger
240 \,+\,
241 \hat{K}_t^{(2)} \dmrho \, {\hat{K}_t^{(2)}}^\dagger
242 * @f]
243 * where @f$ \hat{K}^{(1)} @f$ and @f$ \hat{K}^{(2)} @f$ are one-qubit Kraus operators
244 * @f[
245 \hat{K}^{(1)} = \begin{pmatrix} 1 & 0 \\ 0 & \sqrt{1-p} \end{pmatrix},
246 \;\;
247 \hat{K}^{(1)} = \begin{pmatrix} 0 & \sqrt{p} \\ 0 & 0 \end{pmatrix}.
248 * @f]
249 *
250 * @equivalences
251 *
252 * This function is equivalent to (but much faster than):
253 * - mixKrausMap() with the above Kraus operators.
254 * ```
255 KrausMap map = createInlineKrausMap(1, 2, {
256 {{1,0},{0,sqrt(1-prob)}}, // K1
257 {{0,sqrt(p)},{0,0}} // K2
258 });
259
260 mixKrausMap(qureg, &target, 1, map);
261 * ```
262 *
263 * @notyetvalidated
264 */
265void mixDamping(Qureg qureg, int target, qreal prob);
266
267
268/** @notyetdoced
269 *
270 * @formulae
271 *
272 * Let @f$ \dmrho = @f$ @p qureg, @f$ t = @f$ @p target, and
273 * @f$ p_x = @f$ @p probX, @f$ p_y = @f$ @p probY, @f$ p_z = @f$ @p probZ.
274 *
275 * This function effects
276 * @f[
277 \dmrho \;\rightarrow\;
278 (1 - p) \, \dmrho
279 \,+\,
280 p_x \, \hat{X}_t \dmrho \hat{X}_t
281 \,+\,
282 p_y \, \hat{Y}_t \dmrho \hat{Y}_t
283 \,+\,
284 p_z \, \hat{Z}_t \dmrho \hat{Z}_t.
285 * @f]
286 *
287 * @equivalences
288 *
289 * This function is equivalent to (but much faster than):
290 * - mixKrausMap() with (scaled) @f$\hat{\id}@f$, @f$\hat{X}@f$, @f$\hat{Y}@f$ and @f$\hat{Z}@f$ Kraus operators.
291 * ```
292 qreal a = sqrt(1-probX-probY-probZ);
293 qreal b = sqrt(probX);
294 qreal c = sqrt(probY);
295 qreal d = sqrt(probZ);
296
297 KrausMap map = createInlineKrausMap(1, 4, {
298 {{a,0},{0, a}}, // a * I
299 {{0,b},{b, 0}}, // b * X
300 {{d,0},{0,-d}} // d * Z
301 {{0,-1i*c},{1i*c,0}}, // c * Y
302 });
303
304 mixKrausMap(qureg, &target, 1, map);
305 * ```
306 *
307 * @notyetvalidated
308 */
309void mixPaulis(Qureg qureg, int target, qreal probX, qreal probY, qreal probZ);
310
311
312/** @notyetdoced
313 *
314 * @formulae
315 *
316 * Let @f$ \dmrho_1 = @f$ @p qureg, @f$ \dmrho_2 = @f$ @p other and @f$ p = @f$ @p prob.
317 *
318 * This function effects
319 * @f[
320 \dmrho_1 \;\rightarrow \;
321 (1 - p) \, \dmrho_1
322 \,+\,
323 p \, \dmrho_2.
324 * @f]
325 *
326 * @notyetvalidated
327 */
328void mixQureg(Qureg qureg, Qureg other, qreal prob);
329
330
331/** @notyetdoced
332 *
333 * @formulae
334 *
335 * Let @f$ \dmrho = @f$ @p qureg, @f$ \vec{t} = @f$ @p targets and @f$ \hat{K}^{(i)} @f$
336 * denote the @f$i@f$-th Kraus operator in @p map.
337 *
338 * This function effects
339 * @f[
340 \dmrho \; \rightarrow \;
341 \sum\limits_i
342 \hat{K}_{\vec{t}}^{(i)} \dmrho \, {\hat{K}_{\vec{t}}^{(i)}}^\dagger
343 * @f]
344 *
345 * @notyetvalidated
346 */
347void mixKrausMap(Qureg qureg, int* targets, int numTargets, KrausMap map);
348
349
350/// @notyetdoced
351/// @notyetvalidated
352void mixSuperOp(Qureg qureg, int* targets, int numTargets, SuperOp superop);
353
354
355// end de-mangler
356#ifdef __cplusplus
357}
358#endif
359
360
361
362/*
363 * C++ OVERLOADS
364 *
365 * which are only accessible to C++ binaries, and accept
366 * arguments more natural to C++ (e.g. std::vector). These
367 * are included in the file-wide doxygen group (no subgroups).
368 */
369
370#ifdef __cplusplus
371
372#include <vector>
373
374/// @notyettested
375/// @notyetdoced
376/// @notyetvalidated
377/// @cppvectoroverload
378/// @see mixKrausMap()
379void mixKrausMap(Qureg qureg, std::vector<int> targets, KrausMap map);
380
381/// @notyettested
382/// @notyetdoced
383/// @notyetvalidated
384/// @cppvectoroverload
385/// @see mixSuperOp()
386void mixSuperOp(Qureg qureg, std::vector<int> targets, SuperOp superop);
387
388#endif // __cplusplus
389
390
391
392#endif // DECOHERENCE_H
393
394/** @} */ // (end file-wide doxygen defgroup)
void mixQureg(Qureg qureg, Qureg other, qreal prob)
void mixPaulis(Qureg qureg, int target, qreal probX, qreal probY, qreal probZ)
void mixKrausMap(Qureg qureg, int *targets, int numTargets, KrausMap map)
void mixSuperOp(Qureg qureg, int *targets, int numTargets, SuperOp superop)
void mixTwoQubitDephasing(Qureg qureg, int target1, int target2, qreal prob)
void mixTwoQubitDepolarising(Qureg qureg, int target1, int target2, qreal prob)
void mixDamping(Qureg qureg, int target, qreal prob)
void mixDephasing(Qureg qureg, int target, qreal prob)
void mixDepolarising(Qureg qureg, int target, qreal prob)
Definition qureg.h:49