mimiqcircuits.operations.noisechannel.standards.depolarizing

Classes

Depolarizing(N, p)

N-qubit depolarizing noise channel.

Depolarizing1(p)

Single-qubit depolarizing channel, shorthand for Depolarizing(1, p).

Depolarizing2(p)

Two-qubit depolarizing channel, shorthand for Depolarizing(2, p).

class Depolarizing(N, p)[source]

Bases: krauschannel

N-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 of PauliNoise.

Parameters:
  • N (int) – Number of qubits, at least 1.

  • p (float) – Probability of error, i.e. the probability of not applying the identity. Must be in \([0, 1]\); may be symbolic.

Raises:

ValueError – If N < 1 or a numeric p is outside \([0, 1]\).

See also

Depolarizing1, Depolarizing2, PauliNoise, PauliString

Examples

>>> 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 p substituted by values.

Parameters:

d (dict) – Map from symbols to the values to substitute.

Returns:

A new channel; p becomes a float when it is fully numeric.

Return type:

Depolarizing

Raises:

ValueError – If the substituted p is 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:

list

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:

list

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 as probabilities(). For a parametric channel the entries are symbolic expressions.

Returns:

One symengine matrix per unitary.

Return type:

list

Raises:

ValueError – If the channel is not mixed unitary.

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:

list

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, DiagonalOp or RescaledGate) per Kraus operator.

Return type:

list

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.

True for composite operations such as Control, Power, Inverse, Parallel or IfStatement, False otherwise.

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() and unitarymatrices().

Returns:

True for mixed unitary channel types, False otherwise.

Return type:

bool

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: krauschannel

Single-qubit depolarizing channel, shorthand for Depolarizing(1, p).

Calling Depolarizing1(p) returns a Depolarizing instance, not a Depolarizing1 one.

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: krauschannel

Two-qubit depolarizing channel, shorthand for Depolarizing(2, p).

Calling Depolarizing2(p) returns a Depolarizing instance, not a Depolarizing2 one.

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