channel#

Quantum channels

Classes

AmplitudeDamping([inputs, nqubit, wires, ...])

Amplitude damping channel.

BitFlip([inputs, nqubit, wires, tsr_mode, ...])

Bit flip channel.

Depolarizing([inputs, nqubit, wires, ...])

Depolarizing channel.

GeneralizedAmplitudeDamping([inputs, ...])

Generalized amplitude damping channel.

Pauli([inputs, nqubit, wires, tsr_mode, ...])

Pauli channel.

PhaseDamping([inputs, nqubit, wires, ...])

Phase damping channel.

PhaseFlip([inputs, nqubit, wires, tsr_mode, ...])

Phase flip channel.

class AmplitudeDamping(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Amplitude damping channel.

The amplitude damping channel is defined as:

\[\begin{split}\rho \Rightarrow K_0 \rho K_0^{\dagger} + K_1 \rho K_1^{\dagger}, K_0 = \begin{pmatrix} 1 & 0 \\ 0 & \sqrt{1 - p} \end{pmatrix}, K_1 = \begin{pmatrix} 0 & \sqrt{p} \\ 0 & 0 \end{pmatrix}\end{split}\]
Parameters:
  • inputs (Any) – The parameter of the channel. Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.

class BitFlip(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Bit flip channel.

The bit flip channel is defined as:

\[\rho \Rightarrow (1-p) \rho + p X \rho X^{\dagger}\]
Parameters:
  • inputs (Any) – The parameter of the channel. Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.

class Depolarizing(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Depolarizing channel.

The depolarizing channel is defined as:

\[\rho \Rightarrow (1-p) \rho + p/3 X \rho X^{\dagger} + p/3 Y \rho Y^{\dagger} + p/3 Z \rho Z^{\dagger}\]
Parameters:
  • inputs (Any) – The parameter of the channel. Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.

class GeneralizedAmplitudeDamping(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Generalized amplitude damping channel.

The generalized amplitude damping channel is defined as:

\[\begin{split}\rho \Rightarrow K_0 \rho K_0^{\dagger} + K_1 \rho K_1^{\dagger} + K_2 \rho K_2^{\dagger} + K_3 \rho K_3^{\dagger}, K_0 = \sqrt{p} \begin{pmatrix} 1 & 0 \\ 0 & \sqrt{1 - \gamma} \end{pmatrix}, K_1 = \sqrt{p} \begin{pmatrix} 0 & \sqrt{\gamma} \\ 0 & 0 \end{pmatrix}, K_2 = \sqrt{1 - p} \begin{pmatrix} \sqrt{1 - \gamma} & 0 \\ 0 & 1 \end{pmatrix}, K_3 = \sqrt{1 - p} \begin{pmatrix} 0 & 0 \\ \sqrt{\gamma} & 0 \end{pmatrix}\end{split}\]
Parameters:
  • inputs (Any) – The parameters of the channel. The first parameter is the probability of amplitude damping error, and the second parameter is the damping rate. Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

extra_repr() str[source]#
get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.

inputs_to_tensor(inputs: Any = None) Tensor[source]#

Convert inputs to torch.Tensor.

class Pauli(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Pauli channel.

The Pauli channel is defined as:

\[\rho \Rightarrow (1-px-py-pz) \rho + px X \rho X^{\dagger} + py Y \rho Y^{\dagger} + pz Z \rho Z^{\dagger}\]
Parameters:
  • inputs (Any) – The parameters of the channel. Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

extra_repr() str[source]#
get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.

inputs_to_tensor(inputs: Any = None) Tensor[source]#

Convert inputs to torch.Tensor.

property prob#

The error probabilities.

class PhaseDamping(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Phase damping channel.

The phase damping channel is defined as:

\[\begin{split}\rho \Rightarrow K_0 \rho K_0^{\dagger} + K_1 \rho K_1^{\dagger}, K_0 = \begin{pmatrix} 1 & 0 \\ 0 & \sqrt{1 - p} \end{pmatrix}, K_1 = \begin{pmatrix} 0 & 0 \\ 0 & \sqrt{p} \end{pmatrix}\end{split}\]
Parameters:
  • inputs (Any) – The parameter of the channel. The Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.

class PhaseFlip(inputs: Any = None, nqubit: int = 1, wires: int | list[int] | None = None, tsr_mode: bool = False, requires_grad: bool = False)[source]#

Bases: Channel

Phase flip channel.

The phase flip channel is defined as:

\[\rho \Rightarrow (1-p) \rho + p Z \rho Z^{\dagger}\]
Parameters:
  • inputs (Any) – The parameter of the channel. Default: None

  • nqubit (int) – The number of qubits that the quantum operation acts on. Default: 1

  • wires (int | list[int] | None) – The indices of the qubits that the quantum operation acts on. Default: None

  • tsr_mode (bool) – Whether the quantum operation is in tensor mode, which means the input and output are represented by a tensor of shape \((\text{batch}, 2, ..., 2)\). Default: False

  • requires_grad (bool) – Whether the parameter is nn.Parameter or buffer. Default: False (which means buffer)

get_matrix(theta: Any) Tensor[source]#

Get the local Kraus matrices acting on density matrices.