mindquantum.core.gates.DepolarizingChannel

View Source On Gitee
class mindquantum.core.gates.DepolarizingChannel(p: float, n_qubits: int = 1, **kwargs)[source]

A depolarizing channel.

Depolarizing channel express errors that have probability \(P\) to turn qubit's quantum state into maximally mixed state, by randomly applying one of the pauli gate(I,X,Y,Z) with same probability \(P/4\). And it has probability \(1-P\) to change nothing.

In one qubit case, depolarizing channel applies noise as:

\[\epsilon(\rho) = (1 - P)\rho + P/4( I \rho I + X \rho X + Y \rho Y + Z \rho Z)\]

where \(\rho\) is quantum state as density matrix type; \(P\) is the probability of occurred the depolarizing error.

This channel supports many object qubits. In \(N\) qubit case, depolarizing channel applies noise as:

\[\epsilon(\rho) = (1 - P)\rho + \frac{P}{4^N} \sum_j U_j \rho U_j\]

where \(N\) is the number of object qubits; \(U_j \in \left\{ I, X, Y, Z \right\} ^{\otimes N}\) is many qubit pauli operator.

  • For \(0 \le P \le 1\) case, this channel is a depolarizing channel, and it becomes a completely depolarizing channel when \(P = 1\).

  • However, \(1 < P \le 4^N / (4^N - 1)\) is also an available case, but not a depolarizing channel any more. When \(P = 4^N / (4^N - 1)\) it becomes a uniform Pauli error channel: \(E(\rho) = \sum_j V_j \rho V_j / (4^n - 1)\), where \(V_j = U_j \setminus I^{\otimes N}\).

Parameters
  • p (int, float) – probability of occurred depolarizing error.

  • n_qubits (int) – qubit number of this depolarizing channel. Default: 1.

Examples

>>> from mindquantum.core.gates import DepolarizingChannel
>>> from mindquantum.core.circuit import Circuit
>>> circ = Circuit()
>>> circ += DepolarizingChannel(0.02).on(0)
>>> circ += DepolarizingChannel(0.01, 2).on([0, 1])
>>> print(circ)
      ╔════════════╗ ╔═════════════╗
q0: ──╢ DC(p=1/50) ╟─╢             ╟───
      ╚════════════╝ ║             ║
                     ║ DC(p=1/100) ║
q1: ─────────────────╢             ╟───
                     ╚═════════════╝
get_cpp_obj()[source]

Get underlying C++ object.

matrix()[source]

Kraus operator of the quantum channel.

Returns

list, the kraus matrix of this operator, while order of output is in dictionary

order of \(\left\{ I, X, Y, Z \right\} ^{\otimes N}\).