Channel#

class discopy.quantum.channel.Channel(array, *args, **kwargs)[source]#

Bases: Tensor

A channel is a tensor with CQ types as dom and cod.

Parameters:
  • array – The array of shape dom.to_dim() @ cod.to_dim() inside the channel.

  • dom (T) – The domain of the channel.

  • cod (T) – The codomain of the channel.

dtype#

alias of complex

to_tensor()[source]#

The underlying tensor of a channel.

Return type:

Tensor

classmethod measure(dim, destructive=True)[source]#

Measure a quantum dimension into a classical dimension.

Parameters:
  • dim (Dim) – The dimension of the quantum system to measure.

  • destructive – Whether the measurement discards the qubits.

Return type:

Channel

classmethod encode(dim, constructive=True)[source]#

Encode a classical dimension into a quantum dimension.

Parameters:
  • dim (Dim) – The dimension of the classical system to encode.

  • constructive – Whether the encoding prepares fresh qubits.

Return type:

Channel

classmethod double(quantum)[source]#

Construct a pure quantum channel by doubling a given tensor.

Parameters:

quantum (Tensor) – The tensor from which to make a pure quantum channel.

Return type:

Channel

classmethod single(classical)[source]#

Construct a pure classical channel from a given tensor.

Parameters:

classical (Tensor) – The tensor from which to make a pure classical channel.

Return type:

Channel

classmethod discard(dom)[source]#

Construct the channel that traces out the quantum dimension and takes the marginal distribution over the classical dimension.

Parameters:

dom (CQ) – The classical-quantum dimension to discard.

Return type:

Channel

factory#

alias of Channel