paddle_quantum.channel.base

The source file of the basic class for the quantum channels.

class paddle_quantum.channel.base.Channel(type_repr, representation=None, qubits_idx=None, num_qubits=None, check_legality=True, num_acted_qubits=None, backend=None, dtype=None, name_scope=None)

Bases: Operator

Basic class for quantum channels.

Parameters:
  • type_repr (str) – type of a representation. should be 'Choi', 'Kraus', 'Stinespring'.

  • representation (Tensor | List[Tensor]) – the representation of this channel. Defaults to None i.e. not specified.

  • qubits_idx (Iterable[Iterable[int]] | Iterable[int] | int) – indices of the qubits on which this channel acts on. Defaults to None. i.e. list(range(num_acted_qubits)).

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

  • check_legality (bool) – whether check the completeness of the representation if provided. Defaults to True.

  • num_acted_qubits (int) – the number of qubits that this channel acts on. Defaults to None.

  • backend (Backend) – Backend on which the channel is executed. Defaults to None.

  • dtype (str) – Type of data. Defaults to None.

  • name_scope (str) – Prefix name used by the layer to name parameters. If prefix is “my_layer”, parameter name in MyLayer can be “my_layer_0.w_n”, where “w” is the parameter base name and “n” is an unique suffix auto-generated. If None, prefix name will be snake cased class name. Defaults to None.

Raises:
  • ValueError – Unsupported channel representation for type_repr.

  • NotImplementedError – The noisy channel can only run in density matrix mode.

  • TypeError – Unexpected data type for Channel representation.

Note

If representation is given, then num_acted_qubits will be determined by representation, no matter num_acted_qubits is None or not.

property choi_repr: Tensor

Choi representation of a channel

Returns:

a tensor with shape \([d_\text{out}^2, d_\text{in}^2]\), where \(d_\text{in/out}\) is the input/output dimension of this channel

Raises:

ValueError – Need to specify the Choi representation in this Channel instance.

property kraus_repr: List[Tensor]

Kraus representation of a channel

Returns:

a list of tensors with shape \([d_\text{out}, d_\text{in}]\), where \(d_\text{in/out}\) is the input/output dimension of this channel

Raises:

ValueError – Need to specify the Kraus representation in this Channel instance.

property stinespring_repr: Tensor

Stinespring representation of a channel

Returns:

a tensor with shape \([r * d_\text{out}, d_\text{in}]\), where \(r\) is the rank of this channel and \(d_\text{in/out}\) is the input/output dimension of this channel

Raises:

ValueError – Need to specify the Stinespring representation in this Channel instance.