paddle_quantum.channel.common

The source file of the classes for common quantum channels.

class paddle_quantum.channel.common.BitFlip(prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of bit flip channels.

Such a channel’s Kraus operators are

\[E_0 = \sqrt{1-p} I, E_1 = \sqrt{p} X.\]
Parameters:
  • prob (Tensor | float) – Probability of a bit flip. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.PhaseFlip(prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of phase flip channels.

Such a channel’s Kraus operators are

\[E_0 = \sqrt{1 - p} I, E_1 = \sqrt{p} Z.\]
Parameters:
  • prob (Tensor | float) – Probability of a phase flip. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.BitPhaseFlip(prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of bit phase flip channels.

Such a channel’s Kraus operators are

\[E_0 = \sqrt{1 - p} I, E_1 = \sqrt{p} Y.\]
Parameters:
  • prob (Tensor | float) – Probability of a bit phase flip. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.AmplitudeDamping(gamma, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of amplitude damping channels.

Such a channel’s Kraus operators are

\[\begin{split}E_0 = \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-\gamma} \end{bmatrix}, E_1 = \begin{bmatrix} 0 & \sqrt{\gamma} \\ 0 & 0 \end{bmatrix}.\end{split}\]
Parameters:
  • gamma (Tensor | float) – Damping probability. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.GeneralizedAmplitudeDamping(gamma, prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of generalized amplitude damping channels.

Such a channel’s Kraus operators are

\[\begin{split}E_0 = \sqrt{p} \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-\gamma} \end{bmatrix}, E_1 = \sqrt{p} \begin{bmatrix} 0 & \sqrt{\gamma} \\ 0 & 0 \end{bmatrix},\\ E_2 = \sqrt{1-p} \begin{bmatrix} \sqrt{1-\gamma} & 0 \\ 0 & 1 \end{bmatrix}, E_3 = \sqrt{1-p} \begin{bmatrix} 0 & 0 \\ \sqrt{\gamma} & 0 \end{bmatrix}.\end{split}\]
Parameters:
  • gamma (Tensor | float) – Damping probability. Its value should be in the range \([0, 1]\).

  • prob (Tensor | float) – Excitation probability. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.PhaseDamping(gamma, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of phase damping channels.

Such a channel’s Kraus operators are

\[\begin{split}E_0 = \begin{bmatrix} 1 & 0 \\ 0 & \sqrt{1-\gamma} \end{bmatrix}, E_1 = \begin{bmatrix} 0 & 0 \\ 0 & \sqrt{\gamma} \end{bmatrix}.\end{split}\]
Parameters:
  • gamma (Tensor | float) – Parameter of the phase damping channels. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.Depolarizing(prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of depolarizing channels.

Such a channel’s Kraus operators are

\[E_0 = \sqrt{1-3p/4} I, E_1 = \sqrt{p/4} X, E_2 = \sqrt{p/4} Y, E_3 = \sqrt{p/4} Z.\]
Parameters:
  • prob (Tensor | float) – Parameter of the depolarizing channels. Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

Note

The implementation logic for this feature has been updated. The current version refers to formula (8.102) in Quantum Computation and Quantum Information 10th edition by M.A.Nielsen and I.L.Chuang. Reference: Nielsen, M., & Chuang, I. (2010). Quantum Computation and Quantum Information: 10th Anniversary Edition. Cambridge: Cambridge University Press. doi:10.1017/CBO9780511976667

class paddle_quantum.channel.common.GeneralizedDepolarizing(prob, qubits_idx=None, num_qubits=None)

Bases: Channel

A generalized depolarizing channel.

Such a channel’s Kraus operators are

\[\begin{split}E_0 = \sqrt{1-(D - 1)p/D} I, \text{ where } D = 4^n, \\ E_k = \sqrt{p/D} \sigma_k, \text{ for } 0 < k < D.\end{split}\]
Parameters:
  • prob (Tensor | float) – probability \(p\). Its value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act, the length of which is \(n\). Defaults to be None.

  • num_qubits (int) – Total number of qubits. Defaults to None.

class paddle_quantum.channel.common.PauliChannel(prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of Pauli channels.

Parameters:
  • prob (Tensor | Iterable[float]) – Probabilities corresponding to the Pauli X, Y, and Z operators. Each value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

Note

The sum of three input probabilities should be less than or equal to 1.

class paddle_quantum.channel.common.ResetChannel(prob, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of reset channels.

Such a channel reset the state to \(|0\rangle\) with a probability of p and to \(|1\rangle\) with a probability of q. Its Kraus operators are

\[\begin{split}E_0 = \begin{bmatrix} \sqrt{p} & 0 \\ 0 & 0 \end{bmatrix}, E_1 = \begin{bmatrix} 0 & \sqrt{p} \\ 0 & 0 \end{bmatrix},\\ E_2 = \begin{bmatrix} 0 & 0 \\ \sqrt{q} & 0 \end{bmatrix}, E_3 = \begin{bmatrix} 0 & 0 \\ 0 & \sqrt{q} \end{bmatrix},\\ E_4 = \sqrt{1-p-q} I.\end{split}\]
Parameters:
  • prob (Tensor | Iterable[float]) – Probabilities of resetting to \(|0\rangle\) and to \(|1\rangle\). Each value should be in the range \([0, 1]\).

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

Note

The sum of two input probabilities should be less than or equal to 1.

class paddle_quantum.channel.common.ThermalRelaxation(const_t, exec_time, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of thermal relaxation channels.

Such a channel simulates the mixture of the \(T_1\) and the \(T_2\) processes on superconducting devices.

Parameters:
  • const_t (Tensor | Iterable[float]) – \(T_1\) and \(T_2\) relaxation time in microseconds.

  • exec_time (Tensor | float) – Quantum gate execution time in the process of relaxation in nanoseconds.

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

Note

Relaxation time must satisfy \(T_2 \le T_1\). For reference please see https://arxiv.org/abs/2101.02109.

class paddle_quantum.channel.common.MixedUnitaryChannel(num_unitary, qubits_idx='full', num_qubits=None)

Bases: Channel

A collection of single-qubit mixed unitary channels.

Such a channel’s Kraus operators are randomly generated unitaries times related probabilities

\[N(\rho) = \sum_{i} p_{i} U_{i} \rho U_{i}^{\dagger}\]
Parameters:
  • num_unitary (int) – The amount of random unitaries to be generated.

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act. Defaults to 'full'.

  • num_qubits (int) – Total number of qubits. Defaults to None.

Note

The probability distribution of unitaries is set to be uniform distribution.

class paddle_quantum.channel.common.ReplacementChannel(sigma, qubits_idx=None, num_qubits=None)

Bases: Channel

A collection of quantum replacement channels.

For a quantum state \(\sigma\), the corresponding replacement channel \(R\) is defined as

\[R(\rho) = \text{tr}(\rho)\sigma\]
Parameters:
  • sigma (State) – The state to be replaced.

  • qubits_idx (Iterable[int] | int | str) – Indices of the qubits on which the channels act, the length of which is \(n\). Defaults to be None.

  • num_qubits (int) – Total number of qubits. Defaults to None.