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.
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,...), wherelen(system_input)=len(partition). Defaults toNone.pure (bool, optional) –
Truewhentensoris a “pure” representation (e.g. a pure state, a unitary operator, etc.),Falseotherwise. Defaults toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. IfNone, defaults to the current backend. Defaults toNone.
- classmethod from_operator(operator, partition=None, system_input=None, pure=False, backend=None)[source]#
Construct a
qibo.quantum_info.QuantumNetworkobject from anArrayLike.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. IfNone, defaults to the shape ofarr. Defaults toNone.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...), wherelen(system_input)=len(partition). Defaults toNone.pure (bool, optional) –
Truewhenarris a “pure” representation (e.g. a pure state, a unitary operator, etc.),Falseotherwise. Defaults toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. IfNone, defaults to the current backend. Defaults toNone.
- Returns:
quantum network constructed from the input Choi operator.
- Return type:
- 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). IfTrue, returns the full tensor of the quantum network. Defaults toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used to return the Choi operator. IfNone, defaults to the backend defined when initializing theqibo.quantum_info.quantum_networks.QuantumNetworkobject. Defaults toNone.
- 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. IfNone, defaults to the backend defined when initializing theqibo.quantum_info.quantum_networks.QuantumNetworkobject. Defaults toNone.- Returns:
Choi operator of the quantum network.
- Return type:
ArrayLike
- 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-Schmidtnorm (also known asFrobeniusnorm).For specifications on the other possible values of the parameter
orderfor thetensorflowbackend, please refer to tensorflow.norm. For all other backends, please refer to numpy.linalg.norm.- Parameters:
- 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:
- 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:
- link_product(subscripts, second_network)[source]#
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_productis associative, so we override the @ operation in order to simplify notation.- Parameters:
subscripts (str, optional) – Specifies the subscript for summation using the Einstein summation convention. For more details, please refer to numpy.einsum.
second_network (
qibo.quantum_info.quantum_networks.QuantumNetwork) – Quantum network to be applied to the original network.
- Returns:
- Quantum network resulting
from the link product between two quantum networks.
- Return type:
- 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 toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. IfNone, defaults to the current backend. Defaults toNone.
- 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.
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,...), wherelen(system_input)=len(partition). Defaults toNone.pure (bool, optional) –
Truewhentensoris a “pure” representation (e.g. a pure state, a unitary operator, etc.),Falseotherwise. Defaults toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. IfNone, defaults to the current backend. Defaults toNone.
- 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:
- Returns:
Causal order condition.
- Return type:
- classmethod from_operator(operator, partition=None, inverse=False, pure=False, backend=None)[source]#
Construct a
qibo.quantum_info.QuantumNetworkobject from anArrayLike.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. IfNone, defaults to the shape ofarr. Defaults toNone.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...), wherelen(system_input)=len(partition). Defaults toNone.pure (bool, optional) –
Truewhenarris a “pure” representation (e.g. a pure state, a unitary operator, etc.),Falseotherwise. Defaults toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. IfNone, defaults to the current backend. Defaults toNone.
- Returns:
quantum network constructed from the input Choi operator.
- Return type:
- 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
Nonethe default is(True,False). Defaults toNone.pure (bool, optional) –
Truewhentensoris a “pure” representation (e.g. a pure state, a unitary operator, etc.),Falseotherwise. Defaults toFalse.backend (
qibo.backends.abstract.Backend, optional) – Backend to be used in calculations. IfNone, defaults to the current backend. Defaults toNone.
- 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-Schmidtnorm (also known asFrobeniusnorm).For specifications on the other possible values of the parameter
orderfor thetensorflowbackend, please refer to tensorflow.norm. For all other backends, please refer to numpy.linalg.norm.- Parameters:
- Returns:
Unitality condition.
- Return type:
- 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: