mimiqcircuits.operations.noisechannel.standards.depolarizing¶
Classes
|
N-qubit depolarizing noise channel. |
Single-qubit depolarizing channel, shorthand for |
|
Two-qubit depolarizing channel, shorthand for |
- class Depolarizing(N, p)[source]¶
Bases:
krauschannelN-qubit depolarizing noise channel.
The Kraus operators for the depolarizing channel are given by:
\[E_1 = \sqrt{1-p} I_N, \quad E_i = \sqrt{p/(4^N-1)} P_i,\]where \(p \in [0,1]\) is a probability, and \(P_i\) is an \(N\)-qubit Pauli string operator, i.e., a tensor product of one-qubit Pauli operators.
There is exactly one Kraus operator \(E_{i>1}\) for each distinct combination of Pauli operators \(P_i\), except for the \(N\)-qubit identity \(I_N = I \otimes I \otimes I \otimes \dots\).
For example:
For one qubit, we have 3 operators \(P_i \in \{X, Y, Z\}\).
For two qubits, we have 15 operators \(P_i \in \{ I\otimes X, I\otimes Y, I\otimes Z, X\otimes I, Y\otimes I, Z\otimes I, X\otimes X, X\otimes Y, X\otimes Z, Y\otimes X, Y\otimes Y, Y\otimes Z, Z\otimes X, Z\otimes Y, Z\otimes Z \}\).
This channel is a mixed unitary channel (see
ismixedunitary()), and is a special case ofPauliNoise.- Parameters:
- Raises:
ValueError – If
N < 1or a numericpis outside \([0, 1]\).
See also
Depolarizing1,Depolarizing2,PauliNoise,PauliStringExamples
>>> from mimiqcircuits import * >>> # a depolarizing channel can act on any number of qubits >>> c = Circuit() >>> c.push(Depolarizing(1, 0.1), 1) 2-qubit circuit with 1 instruction: └── Depolarizing(0.1) @ q[1]
>>> c.push(Depolarizing(5, 0.1), 1, 2, 3, 4, 5) 6-qubit circuit with 2 instructions: ├── Depolarizing(0.1) @ q[1] └── Depolarizing(0.1) @ q[1:5]
>>> # for one and two qubits there are shorthands >>> c.push(Depolarizing1(0.1), 1) 6-qubit circuit with 3 instructions: ├── Depolarizing(0.1) @ q[1] ├── Depolarizing(0.1) @ q[1:5] └── Depolarizing(0.1) @ q[1]
>>> c.push(Depolarizing2(0.1), 1, 2) 6-qubit circuit with 4 instructions: ├── Depolarizing(0.1) @ q[1] ├── Depolarizing(0.1) @ q[1:5] ├── Depolarizing(0.1) @ q[1] └── Depolarizing(0.1) @ q[1:2]
- property parnames¶
Names of the operation’s parameters, as a tuple of strings.
Read-only: assigning to it raises
ValueError.
- property num_qubits¶
Number of qubits the operation acts on.
Read-only: assigning to it raises
ValueError.
- evaluate(d={})[source]¶
Return a copy with symbols in
psubstituted by values.- Parameters:
d (dict) – Map from symbols to the values to substitute.
- Returns:
A new channel;
pbecomes a float when it is fully numeric.- Return type:
- Raises:
ValueError – If the substituted
pis outside \([0, 1]\).
- probabilities()[source]¶
Return the probabilities \(p_k\) of a mixed unitary channel.
For \(\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger\) this is the list of \(p_k\), in the same order as
unitarygates().- Returns:
One probability per unitary.
- Return type:
- Raises:
ValueError – If the channel is not mixed unitary.
Examples
>>> from mimiqcircuits import * >>> # identity with probability 0.9, X with probability 0.1 >>> PauliX(0.1).probabilities() [0.9, 0.1]
- unitarygates()[source]¶
Return the unitaries \(U_k\) of a mixed unitary channel as gates.
For \(\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger\) these are the \(U_k\), in the same order as
probabilities().- Returns:
One gate per unitary.
- Return type:
- Raises:
ValueError – If the channel is not mixed unitary.
Examples
>>> from mimiqcircuits import * >>> PauliX(0.1).unitarygates() [ID, X]
- unitarymatrices()[source]¶
Return the matrices of the unitaries \(U_k\) of a mixed unitary channel.
For \(\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger\) these are the matrices of
unitarygates(), in the same order asprobabilities(). For a parametric channel the entries are symbolic expressions.- Returns:
One symengine matrix per unitary.
- Return type:
- Raises:
ValueError – If the channel is not mixed unitary.
See also
Examples
>>> from mimiqcircuits import * >>> # identity and Pauli X >>> PauliX(0.2).unitarymatrices() [[1.0, 0] [0, 1.0] , [0, 1.0] [1.0, 0] ]
- krausmatrices()[source]¶
Return the matrices of the Kraus operators \(E_k\) of the channel.
These are the matrices of
krausoperators(), in the same order. For a parametric channel the entries are symbolic expressions.- Returns:
One symengine matrix per Kraus operator.
- Return type:
Examples
>>> from mimiqcircuits import * >>> AmplitudeDamping(0.36).krausmatrices() [[1.0, 0] [0, 0.8] , [0, 0.6] [0, 0] ]
- krausoperators()[source]¶
Return the Kraus operators \(E_k\) of the channel as operator objects.
Every concrete channel implements this method; the base class raises.
- Returns:
One operator (for example
Operator,DiagonalOporRescaledGate) per Kraus operator.- Return type:
- Raises:
NotImplementedError – When called on a class that does not define it.
Examples
>>> from mimiqcircuits import * >>> # projective noise in Z: project on |0> or on |1> >>> ProjectiveNoise("Z").krausoperators() [P₀(1), P₁(1)]
- iswrapper()[source]¶
Whether the operation wraps another operation.
Truefor composite operations such asControl,Power,Inverse,ParallelorIfStatement,Falseotherwise.- Returns:
bool
- classmethod ismixedunitary()[source]¶
Whether the channel is a mixed unitary channel.
A channel is mixed unitary when every Kraus operator \(E_k\) is proportional to a unitary matrix \(U_k\), so that
\[\mathcal{E}(\rho) = \sum_k p_k U_k \rho U_k^\dagger,\]with probabilities \(0 \leq p_k \leq 1\) that add up to 1. The answer depends only on the channel type, not on its parameters, so this is a class method. Only mixed unitary channels support
probabilities(),cumprobabilities(),unitarygates()andunitarymatrices().- Returns:
Truefor mixed unitary channel types,Falseotherwise.- Return type:
Examples
>>> from mimiqcircuits import * >>> # PauliX applies X with probability p: mixed unitary >>> PauliX(0.1).ismixedunitary() True
>>> # amplitude damping has a non-unitary Kraus operator >>> AmplitudeDamping(0.1).ismixedunitary() False
- class Depolarizing1(p)[source]¶
Bases:
krauschannelSingle-qubit depolarizing channel, shorthand for
Depolarizing(1, p).Calling
Depolarizing1(p)returns aDepolarizinginstance, not aDepolarizing1one.- Parameters:
p (float) – Probability of error, in \([0, 1]\).
Examples
>>> from mimiqcircuits import * >>> # 10% chance of applying X, Y or Z, each with probability 0.1/3 >>> Depolarizing1(0.1) == Depolarizing(1, 0.1) True
- class Depolarizing2(p)[source]¶
Bases:
krauschannelTwo-qubit depolarizing channel, shorthand for
Depolarizing(2, p).Calling
Depolarizing2(p)returns aDepolarizinginstance, not aDepolarizing2one.- Parameters:
p (float) – Probability of error, in \([0, 1]\).
Examples
>>> from mimiqcircuits import * >>> # 10% chance of one of the 15 non-identity two-qubit Pauli strings >>> Depolarizing2(0.1) == Depolarizing(2, 0.1) True