Quantum Networks#

Quantum network is an object that unifies the representation of quantum states, channels, observables, and higher-order quantum operators.

For more details, see G. Chiribella et al., Theoretical framework for quantum networks, Physical Review A 80.2 (2009): 022339.

class qibo.quantum_info.quantum_networks.QuantumNetwork(tensor, partition=None, system_input=None, pure=False, backend=None)[source]#

This class stores the representation of the quantum network as a tensor. This is a unique representation of the quantum network.

A minimum quantum network is a quantum channel, which is a quantum network of the form \(J[n \to m]\), where \(n\) is the dimension of the input system , and \(m\) is the dimension of the output system. A quantum state is a quantum network of the form \(J: 1 \to n\), such that the input system is trivial. An observable is a quantum network of the form \(J: n \to 1\), such that the output system is trivial.

A quantum network may contain multiple input and output systems. For example, a “quantum comb” is a quantum network of the form \(J: n', n \to m, m'\), which convert a quantum channel of the form \(J: n \to m\) to a quantum channel of the form \(J: n' \to m'\).

Parameters:
  • tensor (ArrayLike) – input Choi operator.

  • partition (List[int] or Tuple[int]) – partition of tensor.

  • system_input (List[bool] or Tuple[bool], optional) – mask on the output system of the Choi operator. If None, defaults to (True,False,True,False,...), where len(system_input)=len(partition). Defaults to None.

  • pure (bool, optional) – True when tensor is a “pure” representation (e.g. a pure state, a unitary operator, etc.), False otherwise. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. If None, defaults to the current backend. Defaults to None.

classmethod from_operator(operator, partition=None, system_input=None, pure=False, backend=None)[source]#

Construct a qibo.quantum_info.QuantumNetwork object from an ArrayLike.

This method converts a Choi operator to the internal representation of qibo.quantum_info.quantum_networks.QuantumNetwork. The input array can be a pure state, a Choi operator, a unitary operator, etc.

Parameters:
  • arr (ArrayLike) – input numpy array.

  • partition (List[int] or Tuple[int], optional) – partition of arr. If None, defaults to the shape of arr. Defaults to None.

  • system_input (List[bool] or Tuple[bool], optional) – mask on the input system of the Choi operator. If None, defaults to (True,False,True,False...), where len(system_input)=len(partition). Defaults to None.

  • pure (bool, optional) – True when arr is a “pure” representation (e.g. a pure state, a unitary operator, etc.), False otherwise. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. If None, defaults to the current backend. Defaults to None.

Returns:

quantum network constructed from the input Choi operator.

Return type:

qibo.quantum_info.quantum_networks.QuantumNetwork

operator(full=False, backend=None)[source]#

Returns the Choi operator of the quantum network.

The shape of the returned operator is \((*self.partition, *self.partition)\).

Parameters:
  • full (bool, optional) – If this is False, and the network is pure, the method will only return the eigenvector (unique when the network is pure). If True, returns the full tensor of the quantum network. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used to return the Choi operator. If None, defaults to the backend defined when initializing the qibo.quantum_info.quantum_networks.QuantumNetwork object. Defaults to None.

Returns:

Choi operator of the quantum network.

Return type:

ArrayLike

matrix(backend=None)[source]#

Returns the Choi operator of the quantum network in the matrix form. The shape of the returned operator is \((self.dims, self.dims)\).

Parameters:

backend (qibo.backends.abstract.Backend, optional) – Backend to be used to return the Choi operator. If None, defaults to the backend defined when initializing the qibo.quantum_info.quantum_networks.QuantumNetwork object. Defaults to None.

Returns:

Choi operator of the quantum network.

Return type:

ArrayLike

is_pure()[source]#

Returns bool indicating if the Choi operator of the network is pure.

is_hermitian(order=None, precision_tol=1e-08)[source]#

Returns bool indicating if the Choi operator \(\mathcal{J}\) is Hermitian.

Hermiticity is calculated as distance between \(\mathcal{J}\) and \(\mathcal{J}^{\dagger}\) with respect to a given norm. Default is the Hilbert-Schmidt norm (also known as Frobenius norm).

For specifications on the other possible values of the parameter order for the tensorflow backend, please refer to tensorflow.norm. For all other backends, please refer to numpy.linalg.norm.

Parameters:
  • order (str or int, optional) – order of the norm. Defaults to None.

  • precision_tol (float, optional) – threshold \(\epsilon\) that defines if Choi operator of the network is \(\epsilon\)-close to Hermiticity in the norm given by order. Defaults to \(10^{-8}\).

Returns:

Hermiticity condition. If the adjoint of the Choi operator is equal to the

Choi operator, the method returns True. If the input is pure, the its always Hermitian.

Return type:

bool

is_positive_semidefinite(precision_tol=1e-08)[source]#

Returns bool indicating if Choi operator \(\mathcal{J}\) is positive-semidefinite.

Parameters:

precision_tol (float, optional) – threshold value used to check if eigenvalues of the Choi operator \(\mathcal{J}\) are such that \(\textup{eigenvalues}(\mathcal{J}) >= - \textup{precision_tol}\). It must be non-negative. Defaults to \(10^{-8}\).

Returns:

Positive-semidefinite condition.

Return type:

bool

Link product between two quantum networks.

The link product is not commutative. Here, we assume that \(A.\textup{link_product}(B)\) means “applying \(B\) to \(A\)”. However, the link_product is associative, so we override the @ operation in order to simplify notation.

Parameters:
Returns:

Quantum network resulting

from the link product between two quantum networks.

Return type:

qibo.quantum_info.quantum_networks.QuantumNetwork

copy()[source]#

Returns a copy of the qibo.quantum_info.QuantumNetwork object.

conj()[source]#

Returns the conjugate of the quantum network.

full(update=False, backend=None)[source]#

Convert the internal representation to the full tensor of the network.

Parameters:
  • update (bool, optional) – If True, updates the internal representation of the network to the full tensor. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. If None, defaults to the current backend. Defaults to None.

Returns:

full representation of the quantum network.

Return type:

ArrayLike

class qibo.quantum_info.quantum_networks.QuantumComb(tensor, partition=None, system_input=None, pure=False, backend=None)[source]#

Stores a Quantum comb, which is a network in which the systems follows a sequential order.

It is also called the non-Markovian quantum process in many literatures. A quantum comb is a quantum network of the form \(J[┍i1┑,┕o1┙,┍i2┑,┕o2┙, ...]\), where the process first take an input state from system \(i1\), then output a state to system \(o1\), and so on. This is a non-Markovian process as the output of the system \(o2\) may depend on what happened in systems \(i1\), and \(o1\).

A quantum channel is a special case of quantum comb, where there are only one input system and one output system.

Parameters:
  • tensor (ArrayLike) – the tensor representations of the quantum Comb.

  • partition (List[int] or Tuple[int]) – partition of matrix.

  • system_input (List[bool] or Tuple[bool], optional) – mask on the input system of the Choi operator. If None, defaults to (True,False,True,False,...), where len(system_input)=len(partition). Defaults to None.

  • pure (bool, optional) – True when tensor is a “pure” representation (e.g. a pure state, a unitary operator, etc.), False otherwise. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. If None, defaults to the current backend. Defaults to None.

is_causal(order=None, precision_tol=1e-08)[source]#

Returns bool indicating if the Choi operator \(\mathcal{J}\) satisfies causal order

Causality is calculated based on a recursive constrains. This method reduce a n-comb to a (n-1)-comb at each step, and checks if the reduced comb is independent on the last output system.

Parameters:
  • order (str or int, optional) – order of the norm. Defaults to None.

  • precision_tol (float, optional) – threshold \(\epsilon\) that defines if Choi operator of the network is \(\epsilon\)-close to causality in the norm given by order. Defaults to \(10^{-8}\).

Returns:

Causal order condition.

Return type:

bool

classmethod from_operator(operator, partition=None, inverse=False, pure=False, backend=None)[source]#

Construct a qibo.quantum_info.QuantumNetwork object from an ArrayLike.

This method converts a Choi operator to the internal representation of qibo.quantum_info.quantum_networks.QuantumNetwork. The input array can be a pure state, a Choi operator, a unitary operator, etc.

Parameters:
  • arr (ArrayLike) – input numpy array.

  • partition (List[int] or Tuple[int], optional) – partition of arr. If None, defaults to the shape of arr. Defaults to None.

  • system_input (List[bool] or Tuple[bool], optional) – mask on the input system of the Choi operator. If None, defaults to (True,False,True,False...), where len(system_input)=len(partition). Defaults to None.

  • pure (bool, optional) – True when arr is a “pure” representation (e.g. a pure state, a unitary operator, etc.), False otherwise. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. If None, defaults to the current backend. Defaults to None.

Returns:

quantum network constructed from the input Choi operator.

Return type:

qibo.quantum_info.quantum_networks.QuantumNetwork

class qibo.quantum_info.quantum_networks.QuantumChannel(tensor, partition=None, system_input=None, pure=False, backend=None)[source]#

Stores a Quantum channel, which is a special case of quantum comb.

A quantum channel is a quantum comb with only one input and one output. This class includes all quantum channels, unitary operators, and quantum states.

To construct a QuantumChannel object, one can use the QuantumNetwork.from_nparray method. Note: if one try to construct a quantum network from a unitary operator or Choi operator, the first system will be the output. However, here we assume the first system is the input system. It is important to specify inverse=True when constructing by QuantumNetwork.from_nparray.

Parameters:
  • tensor (ArrayLike) – the tensor representations of the quantum comb.

  • partition (List[int] or Tuple[int], optional) – partition of matrix. If not provided and system_input is None, assume the input is a quantum state, whose input is a trivial system. If system_input is set to True, assume the input is an observable, whose output is a trivial system.

  • system_input (List[bool] or Tuple[bool], optional) – mask on the input system of the Choi operator. If None the default is (True,False). Defaults to None.

  • pure (bool, optional) – True when tensor is a “pure” representation (e.g. a pure state, a unitary operator, etc.), False otherwise. Defaults to False.

  • backend (qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. If None, defaults to the current backend. Defaults to None.

is_unital(order=None, precision_tol=1e-08)[source]#

Returns bool indicating if the Choi operator \(\mathcal{J}\) is unital.

A map is unital if it preserves the identity operator. Unitality is calculated as distance between the partial trace of \(\mathcal{J}\) and the Identity operator \(I\), with respect to a given norm. Default is the Hilbert-Schmidt norm (also known as Frobenius norm).

For specifications on the other possible values of the parameter order for the tensorflow backend, please refer to tensorflow.norm. For all other backends, please refer to numpy.linalg.norm.

Parameters:
  • order (str or int, optional) – order of the norm. Defaults to None.

  • precision_tol (float, optional) – threshold \(\epsilon\) that defines if Choi operator of the network is \(\epsilon\)-close to unitality in the norm given by order. Defaults to \(10^{-8}\).

Returns:

Unitality condition.

Return type:

bool

is_channel(order=None, precision_tol_causal=1e-08, precision_tol_psd=1e-08)[source]#

Returns bool indicating if Choi operator \(\mathcal{E}\) is a channel.

Parameters:
  • order (int or str, optional) – order of the norm used to calculate causality. Defaults to None.

  • precision_tol_causal (float, optional) – threshold \(\epsilon\) that defines if Choi operator of the network is \(\epsilon\)-close to causality in the norm given by order. Defaults to \(10^{-8}\).

  • precision_tol_psd (float, optional) – threshold value used to check if eigenvalues of the Choi operator \(\mathcal{E}\) are such that \(\textup{eigenvalues}(\mathcal{E}) >= - \textup{precision_tol_psd}\). It must be non-negative. Defaults to \(10^{-8}\).

Returns:

Channel condition.

Return type:

bool

apply(state)[source]#

Apply the Choi operator \(\mathcal{E}\) to state \(\varrho\).

It is assumed that state \(\varrho\) is a density matrix.

Parameters:

state (ArrayLike) – density matrix of a state.

Returns:

Resulting state \(\mathcal{E}(\varrho)\).

Return type:

ArrayLike