![]() |
The Quantum Exact Simulation Toolkit v4.3.0
|
Functions for effecting decoherence channels upon density matrices. More...
Functions | |
| void | mixDamping (Qureg qureg, int target, qreal prob) |
| void | mixDephasing (Qureg qureg, int target, qreal prob) |
| void | mixDepolarising (Qureg qureg, int target, qreal prob) |
| void | mixKrausMap (Qureg qureg, int *targets, int numTargets, KrausMap map) |
| void | mixPaulis (Qureg qureg, int target, qreal probX, qreal probY, qreal probZ) |
| void | mixQureg (Qureg qureg, Qureg other, qreal prob) |
| 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) |
Functions for effecting decoherence channels upon density matrices.
| void mixDamping | ( | Qureg | qureg, |
| int | target, | ||
| qreal | prob ) |
Applies a one-qubit amplitude damping channel upon the density matrix qureg, where prob is the probability of the target qubit relaxing to the zero state.
Let \( \dmrho = \) qureg, \( p = \) prob and \( t = \) target.
This function effects
\[ \dmrho \; \rightarrow \; \hat{K}_t^{(1)} \dmrho \, {\hat{K}_t^{(1)}}^\dagger \,+\, \hat{K}_t^{(2)} \dmrho \, {\hat{K}_t^{(2)}}^\dagger \]
where \( \hat{K}^{(1)} \) and \( \hat{K}^{(2)} \) are one-qubit Kraus operators
\[ \hat{K}^{(1)} = \begin{pmatrix} 1 & 0 \\ 0 & \sqrt{1-p} \end{pmatrix}, \;\; \hat{K}^{(2)} = \begin{pmatrix} 0 & \sqrt{p} \\ 0 & 0 \end{pmatrix}. \]
This is a physically valid operation (the channel is completely positive and trace preserving) for \( 0 \le p \le 1 \). Note however that it may actually reduce mixing and increase purity, depending on \( p \) and the qubit's initial state.
prob must be a valid probability and ergo satisfy \( 0 \le p \le 1 \). Beware that disabling validation with setQuESTValidationOff() and passing prob outside this domain will result in mathematically erroneous results; amplitudes which are erroneously zero, or NaN, as output by sqrt().This function is equivalent to (but much faster than):
| [in,out] | qureg | the density matrix to modify. |
| [in] | target | the index of the target qubit. |
| [in] | prob | the probability of relaxing to zero. |
| error |
|
Definition at line 91 of file decoherence.cpp.
Referenced by TEST_CASE(), and TEST_CASE().
| void mixDephasing | ( | Qureg | qureg, |
| int | target, | ||
| qreal | prob ) |
Applies a one-qubit dephasing channel upon the density matrix qureg, where prob is the probability of a \( \hat{Z} \) error upon the target qubit.
This is also known as a phase-flip channel.
Let \( \dmrho = \) qureg, \( p = \) prob and \( t = \) target.
This function effects
\[ \dmrho \;\rightarrow\; (1 - p) \, \dmrho \,+\, p \, \hat{Z}_t \,\dmrho\, \hat{Z}_t. \]
This is a physically valid operation (is completely positive and trace preserving) when \( 0 \le p \le 1 \), and is a meaningful noise channel (i.e. induces mixing) for \( 0 < p \le 1/2 \).
prob must be a valid probability and ergo satisfy \( 0 \le p \le 1 \) unless validation is disabled via setQuESTValidationOff(), which permits quasi-probability channels with, for example, negative probabilities.This function is equivalent to (but much faster than):
| [in,out] | qureg | the density matrix to modify. |
| [in] | target | the index of the target qubit. |
| [in] | prob | the probability of any error. |
| error |
|
Definition at line 31 of file decoherence.cpp.
Referenced by TEST_CASE(), and TEST_CASE().
| void mixDepolarising | ( | Qureg | qureg, |
| int | target, | ||
| qreal | prob ) |
Applies a one-qubit homogeneous depolarising channel upon the density matrix qureg, where prob is the probability of any error upon the target qubit.
Let \( \dmrho = \) qureg, \( p = \) prob and \( t = \) target.
This function effects
\[ \dmrho \;\rightarrow\; (1 - p) \, \dmrho \,+\, \frac{p}{3} \left( \hat{X}_t \dmrho \hat{X}_t \,+\, \hat{Y}_t \dmrho \hat{Y}_t \,+\, \hat{Z}_t \dmrho \hat{Z}_t \right). \]
This is a physically valid operation (is completely positive and trace preserving) when \( 0 \le p \le 1 \), and is a meaningful noise channel (i.e. induces mixing) for \( 0 < p \le 3/4 \).
prob must be a valid probability and ergo satisfy \( 0 \le p \le 1 \) unless validation is disabled via setQuESTValidationOff(), which permits quasi-probability channels with, for example, negative probabilities.This function is equivalent to (but much faster than):
| [in,out] | qureg | the density matrix to modify. |
| [in] | target | the index of the target qubit. |
| [in] | prob | the probability of any error. |
| error |
|
Definition at line 61 of file decoherence.cpp.
Referenced by TEST_CASE(), and TEST_CASE().
Applies a general, any-size channel described as a Kraus map upon the density matrix qureg.
Let \( \dmrho = \) qureg, \( \vec{t} = \) targets and \( \hat{K}^{(i)} \) denote the \(i\)-th Kraus operator in map.
This function effects
\[ \dmrho \; \rightarrow \; \sum\limits_i \hat{K}_{\vec{t}}^{(i)} \dmrho \, {\hat{K}_{\vec{t}}^{(i)}}^\dagger. \]
The channel is completely positive and trace preserving (CPTP) when the Kraus operators satisfy
\[ \sum\limits_i {\hat{K}_{\vec{t}}^{(i)}}^\dagger \hat{K}_{\vec{t}}^{(i)} = \mathbb{1}. \]
numTargets must agree with the size of the Kraus map.qureg is distributed, each node must contain at least pow(2,2*numTargets) many amplitudes, to ensure sufficient communication buffers are allocated.This function calls mixSuperOp(), passing the corresponding superoperator of map, which has the form
\[ \hat{S} = \sum\limits_i {\hat{K}_{\vec{t}}^{(i)}}^* \otimes \hat{K}_{\vec{t}}^{(i)}. \]
| [in,out] | qureg | the density matrix to modify. |
| [in] | targets | the list of target qubit indices. |
| [in] | numTargets | the length of targets |
| [in] | map | a compatible-sized KrausMap. |
| error |
|
Definition at line 121 of file decoherence.cpp.
Referenced by mixKrausMap(), and TEST_CASE().
| void mixPaulis | ( | Qureg | qureg, |
| int | target, | ||
| qreal | probX, | ||
| qreal | probY, | ||
| qreal | probZ ) |
Applies a one-qubit inhomogeneous Pauli channel upon the density matrix qureg.
This is a generalisation of mixDepolarising(), permitting inhomogeneous error probabilities.
Let \( \dmrho = \) qureg, \( t = \) target, and \( p_x = \) probX, \( p_y = \) probY, \( p_z = \) probZ.
This function effects
\[ \dmrho \;\rightarrow\; (1 - p) \, \dmrho \,+\, p_x \, \hat{X}_t \dmrho \hat{X}_t \,+\, p_y \, \hat{Y}_t \dmrho \hat{Y}_t \,+\, p_z \, \hat{Z}_t \dmrho \hat{Z}_t. \]
This operation is physically valid (completely positive and trace preserving) when each probability is valid ( \( 0 \le p_i \le 1 \)), and together satisfy
\[ p_x + p_y + p_z \le 1. \]
The operation is a meaningful noise channel (decreases purity) when the probabilities are below that which induces maximal mixing; when the probability of no error is greater than (or equal to) the probability of any error.
\[ 1 - (p_x + p_y + p_z) \ge \max(p_x, p_y, p_z). \]
probX, probY, and probZ must be a valid probability, i.e. \( 0 \le p_i \le 1 \), and the probability of no error (one minus their sum) must also be valid. This particular validation is insensitive to the validation epsilon as controlled with setQuESTValidationEpsilon(), but can instead be relaxed with setQuESTValidationOff(), to effect channels which are not completely-positive and trace-preserving, such as quasi-probability channels.This function is equivalent to (but much faster than):
| [in,out] | qureg | the density matrix to modify. |
| [in] | target | the index of the target qubit. |
| [in] | probX | the probability of an X operator upon target. |
| [in] | probY | the probability of an Y operator upon target. |
| [in] | probZ | the probability of an Z operator upon target. |
| error |
|
Definition at line 106 of file decoherence.cpp.
Referenced by TEST_CASE().
Modifies the density matrix qureg to the mixture of itself and the density matrix or statevector other.
Let \( \dmrho_1 = \) qureg and \( p = \) prob.
other is a density matrix \( \dmrho_2 \), this function effects \[ \dmrho_1 \;\rightarrow \; (1 - p) \, \dmrho_1 \,+\, p \, \dmrho_2. \]
other is a statevector \( \ket{\psi_2} \), this function effects \[ \dmrho_1 \;\rightarrow \; (1 - p) \, \dmrho_1 \,+\, p \, \ketbra{\psi_2}{\psi_2}. \]
prob must be a valid probability, satisfying \( 0 \le p \le 1 \), though can be relaxed to any real scalar by disabling validation with setQuESTValidationOff().qureg and other must contain the same number of qubits.other is a density matrix, it must be identically distributed to qureg (although the parallelisation backends, like multithreading and GPU acceleration, are permitted to differ).other is a statevector and qureg is not distributed, neither too must other.| [in,out] | qureg | the density matrix to modify. |
| [in] | other | the density matrix or statevector to mix into qureg. |
| [in] | prob | the coefficient of other in the mixture. |
| error |
|
Definition at line 133 of file decoherence.cpp.
Referenced by TEST_CASE().
Applies a superoperator upon the linearised density matrix qureg, where targets span the ket space.
Let \( \dmrho = \) qureg contain \(N\) qubits, with amplitudes \( \alpha_{ij} \).
\[ \dmrho = \sum\limits_i^{2^N} \sum\limits_j^{2^N} \alpha_{ij} \ket{i}\bra{j}. \]
Internally, this matrix of dimension \( 2^N \times 2^N \) is stored in a vectorised form \( \ket{\rho} \) of dimension \( 2^{2N} \times 1 \), which concatenates the columns of \( \dmrho \).
\[ \begin{aligned} \ket{\rho} &= \sum\limits_i^{2^N} \sum\limits_j^{2^N} \alpha_{ij} \ket{j} \ket{i} \\ &= \sum\limits_k^{2^{2N}} \beta_k \ket{k} \end{aligned} \]
This resembles an unnormalised statevector of twice as many qubits as \( \dmrho \), whereby operators are left- and right-multiplied as
\[ \ket{ \hat{A} \, \rho \, \hat{B} } = \hat{B}^T\otimes \hat{A} \ket{\rho}. \]
Let \( \vec{t} = \) targets, \( n = \) numTargets, and let \( \hat{S} = \) superop. The \(n\)-qubit superoperator \(\hat{S}\) is a \( 2^{2n} \times 2^{2n} \) complex matrix which operates upon both the ket and bra partitions of the linearised density matrix \(\ket{\rho}\).
The targets \(\vec{t}\) are treated as the ket qubits, specified in order of increasing significance, where the first qubit corresponds to the rightmost partition of the matrix \(\hat{S}\). Concretely, let \(\vec{t}+N\) notate the list of indices obtained by adding \(N\) to every element of \(\vec{t}\), and let \((\vec{t} \cup \vec{t}+N)\) the result of concatenating this new list with \(\vec{t}\). Then, this function effects
\[ \ket{\rho} \rightarrow \hat{S}_{(\vec{t} \cup \vec{t}+N)} \ket{\rho}, \]
which is mathematically identical to left-applying the \(2n\)-qubit matrix \(\hat{S}\) upon a \(2N\)-qubit statevector \(\ket{\rho}\).
See mixKrausMap() for an example of the construction of \(\hat{S}\).
superop is CPTP, and so is permitted to break state normalisation and interpretability.superop acts.qureg is distributed, each node must contain at least pow(2,2*numTargets) many amplitudes, to ensure sufficient communication buffers are allocated.This function is equivalent to calling leftapplyCompMatr() upon qureg, having prepared superop as a CompMatr, and passing a target list prepared as \((\vec{t} \cup \vec{t}+N)\) above.
| [in,out] | qureg | the density matrix to modify. |
| [in] | targets | the list of target qubit indices. |
| [in] | numTargets | the length of targets |
| [in] | superop | a compatible-sized SuperOp. |
| error |
|
Definition at line 144 of file decoherence.cpp.
Referenced by mixSuperOp(), and TEST_CASE().
| void mixTwoQubitDephasing | ( | Qureg | qureg, |
| int | target1, | ||
| int | target2, | ||
| qreal | prob ) |
Applies a two-qubit dephasing channel upon the density matrix qureg, where prob is the probability of a \( \hat{Z} \) error upon either or both of qubits target1 and target2, which are interchangeable.
Let \( \dmrho = \) qureg, \( p = \) prob, \( t_1 = \) target1 and \( t_2 = \) target2.
This function effects
\[ \dmrho \;\rightarrow\; (1 - p) \, \dmrho \,+\, \frac{p}{3} \left( \hat{Z}_{t_1} \dmrho \hat{Z}_{t_1} \,+\, \hat{Z}_{t_2} \dmrho \hat{Z}_{t_2} \,+\, \hat{Z}_{t_1} \hat{Z}_{t_2} \dmrho \hat{Z}_{t_1} \hat{Z}_{t_2} \right). \]
This is a physically valid operation (is completely positive and trace preserving) when \( 0 \le p \le 1 \), and is a meaningful noise channel (i.e. induces mixing) for \( 0 < p \le 3/4 \).
prob must be a valid probability and ergo satisfy \( 0 \le p \le 1 \) unless validation is disabled via setQuESTValidationOff(), which permits quasi-probability channels with, for example, negative probabilities.This function is equivalent to (but much faster than):
| [in,out] | qureg | the density matrix to modify. |
| [in] | target1 | the index of the first target qubit. |
| [in] | target2 | the index of the second target qubit. |
| [in] | prob | the probability of any error. |
| error |
|
Definition at line 46 of file decoherence.cpp.
Referenced by TEST_CASE(), and TEST_CASE().
| void mixTwoQubitDepolarising | ( | Qureg | qureg, |
| int | target1, | ||
| int | target2, | ||
| qreal | prob ) |
Applies a two-qubit homogeneous depolarising channel upon the density matrix qureg, where prob is the probability of any error upon either or both of qubits target1 and target2, which are interchangeable.
Let \( \dmrho = \) qureg, \( p = \) prob, \( t_1 = \) target1 and \( t_2 = \) target2.
This function effects:
\[ \dmrho \; \rightarrow \; (1 - p) \dmrho + \frac{p}{15} \left( \sum_{\hat{\sigma} \in \{\hat{\id},\hat{X},\hat{Y},\hat{Z}\}} \sum_{\hat{\sigma}' \in \{\hat{\id},\hat{X},\hat{Y},\hat{Z}\}} \hat{\sigma}_{t_1} \hat{\sigma}_{t_2}' \; \dmrho \; \hat{\sigma}_{t_1} \hat{\sigma}_{t_2}' \right) - \frac{p}{15} \hat{\id}_{t_1} \hat{\id}_{t_2} \dmrho \hat{\id}_{t_1} \hat{\id}_{t_2}, \]
or verbosely:
\[ \dmrho \; \rightarrow \; (1 - p) \, \rho + \frac{p}{15} \; \left( \begin{gathered} \hat{X}_{t_1} \, \rho \, \hat{X}_{t_1} + \hat{Y}_{t_1} \, \rho \, \hat{Y}_{t_1} + \hat{Z}_{t_1} \, \rho \, \hat{Z}_{t_1} + \\ \hat{X}_{t_2} \, \rho \, \hat{X}_{t_2} + \hat{Y}_{t_2} \, \rho \, \hat{Y}_{t_2} + \hat{Z}_{t_2} \, \rho \, \hat{Z}_{t_2} + \\ \hat{X}_{t_1} \hat{X}_{t_2} \, \rho \, \hat{X}_{t_1} \hat{X}_{t_2} + \hat{Y}_{t_1} \hat{Y}_{t_2} \, \rho \, \hat{Y}_{t_1} \hat{Y}_{t_2} + \hat{Z}_{t_1} \hat{Z}_{t_2} \, \rho \, \hat{Z}_{t_1} \hat{Z}_{t_2} + \\ \hat{X}_{t_1} \hat{Y}_{t_2} \, \rho \, \hat{X}_{t_1} \hat{Y}_{t_2} + \hat{Y}_{t_1} \hat{Z}_{t_2} \, \rho \, \hat{Y}_{t_1} \hat{Z}_{t_2} + \hat{Z}_{t_1} \hat{X}_{t_2} \, \rho \, \hat{Z}_{t_1} \hat{X}_{t_2} + \\ \hat{X}_{t_1} \hat{Z}_{t_2} \, \rho \, \hat{X}_{t_1} \hat{Z}_{t_2} + \hat{Y}_{t_1} \hat{X}_{t_2} \, \rho \, \hat{Y}_{t_1} \hat{X}_{t_2} + \hat{Z}_{t_1} \hat{Y}_{t_2} \, \rho \, \hat{Z}_{t_1} \hat{Y}_{t_2} \end{gathered} \right). \]
This is a physically valid operation (is completely positive and trace preserving) when \( 0 \le p \le 1 \), and is a meaningful noise channel (i.e. induces mixing) for \( 0 < p \le 15/16 \).
prob must be a valid probability and ergo satisfy \( 0 \le p \le 1 \) unless validation is disabled via setQuESTValidationOff(), which permits quasi-probability channels with, for example, negative probabilities.This function is equivalent to (but much faster than):
| [in,out] | qureg | the density matrix to modify. |
| [in] | target1 | the index of the first target qubit. |
| [in] | target2 | the index of the second target qubit. |
| [in] | prob | the probability of any error. |
| error |
|
Definition at line 76 of file decoherence.cpp.
Referenced by TEST_CASE(), and TEST_CASE().