Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving documentation for QuantumNetwork class + bug fix #1192

Merged
merged 22 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b14b1cc
minor fix: [@BrunoLiegiBastonLiegi](https://github.com/qiboteam/qibo/…
Canoming Feb 5, 2024
f0ba5ad
update doc strings for `QuantumNetwork`
Canoming Feb 5, 2024
11e8e3d
Merge branch 'master' into quantum_networks
Canoming Feb 5, 2024
09256fc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 5, 2024
a0a4c53
small fixes
renatomello Feb 6, 2024
a87ef85
move couple of lines to `qibo.rst`
renatomello Feb 6, 2024
a5ceac4
Merge branch 'master' into quantum_networks
renatomello Feb 6, 2024
65914fa
Update src/qibo/quantum_info/quantum_networks.py
renatomello Feb 6, 2024
3abdec7
Update src/qibo/quantum_info/quantum_networks.py
renatomello Feb 6, 2024
eac7469
Merge branch 'master' into quantum_networks
renatomello Feb 6, 2024
8b6ca77
correct the behavior of applying a quantum comb to a quantum channel
Canoming Feb 6, 2024
2869d3e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 6, 2024
3c86cad
Merge branch 'master' into quantum_networks
renatomello Feb 7, 2024
f2c86a3
Merge branch 'quantum_networks' of github.com:qiboteam/qibo into quan…
renatomello Feb 7, 2024
e6c9809
update test for combs
Canoming Feb 7, 2024
a876281
add a tutorial for `QuantumNetwork`
Canoming Feb 7, 2024
ee58ad8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 7, 2024
cda5633
Merge branch 'master' into quantum_networks
renatomello Feb 7, 2024
a18089b
Merge branch 'master' into quantum_networks
renatomello Feb 7, 2024
c1cfe94
fix math rendering in docs
Canoming Feb 7, 2024
48e4aa9
fix math rendering in docs
Canoming Feb 7, 2024
d5f8ab1
fix math rendering in docs
Canoming Feb 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/source/api-reference/qibo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,13 @@ Frame Potential
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
<https://journals.aps.org/pra/abstract/10.1103/PhysRevA.80.022339>`_.

.. autoclass:: qibo.quantum_info.quantum_networks.QuantumNetwork
:members:
:member-order: bysource
Expand Down
122 changes: 122 additions & 0 deletions doc/source/code-examples/tutorials/quantum_networks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Quantum Networks

## The Quantum Network Model

The quantum network model is a mathematical framework that allows us to uniquely describe quantum information processing that involves multiple points in time and space.
Each distinguished point in time and space is treated as a linear system $\mathcal{H}_ i$.
A quantum network involving $n$ points in time and space is a Hermitian operator $\mathcal{N}$ that acts on the tensor product of the linear systems $\mathcal{H}_ 0 \otimes \mathcal{H}_ 1 \otimes \cdots \otimes \mathcal{H}_ {n-1}$.
Each system $\mathcal{H}_ {i}$ is either an input or an output of the network.

A physically implementable quantum network is described by a semi-positive definite operator $\mathcal{N}$ that satisfies the causal constraints.

A simple example is a quantum channel $\Gamma: \mathcal{H}_ 0 \to \mathcal{H}_ 1$, where $\mathcal{H}_ 0$ is the input system and $\mathcal{H}_ 1$ is the output system.
The quantum channel is a linear map, such that it maps any input quantum state to an output quantum state, which is a sufficient and necessary condition for the map to be physical.
A Hermitian operator $J^\Gamma$ acting on $\mathcal{H}_ 0\otimes \mathcal{H}_ 1$ is associated with a quantum channel $\Gamma$, if $J^\Gamma$ satisfies the following conditions:
$$J^\Gamma \geq 0, \quad \text{and} \quad \text{Tr}_ {\mathcal{H}_ 1} J^\Gamma = \mathbb{I}_ {\mathcal{H} _0} .$$

The first condition is called *complete positivity*, and the second condition is called *trace-preserving*.
In particular, the second condition ensures that the information of the input system is only accessible through the output system.

In particular, a quantum state $\rho$ may be also considered as a quantum network, where the input system is the trivial system $\mathbb{C}$, and the output system is the quantum system $\mathcal{H}$.
The constraints on the quantum channels are then equivalent to the constraints on the quantum states:
$$\rho \geq 0, \quad \text{and} \quad \text{Tr} \rho = \mathbb{I}_ \mathbb{C} = 1\ .$$

> For more details, see G. Chiribella *et al.*, *Theoretical framework for quantum networks*,
> [Physical Review A 80.2 (2009): 022339](https://journals.aps.org/pra/abstract/10.1103/PhysRevA.80.022339).

## Quantum Network in `qibo`

The manipulation of quantum networks in `qibo` is done through the `QuantumNetwork` class.

```python
from qibo.quantum_info.quantum_networks import QuantumNetwork
```

A quantum state is a quantum network with a single input system and a single output system, where the input system is the trivial 1-dimensional system.
We need to specify the dimensions of each system in the `partition` argument.

```python
from qibo.quantum_info import random_density_matrix, random_unitary

state = random_density_matrix(2)
state_choi = QuantumNetwork(state, (1,2))
print(f'A quantum state is a quantum netowrk of the form {state_choi}')
```

```
>>> A quantum state is a quantum netowrk of the form J[1 -> 2]
```

A general quantum channel can be created in a similar way.

```python
from qibo.gates import DepolarizingChannel

test_ch = DepolarizingChannel(0,0.5)
N = len(test_ch.target_qubits)
partition = (2**N, 2**N)

depolar_choi = QuantumNetwork(test_ch.to_choi(), partition)
print(f'A quantum channel is a quantum netowrk of the form {depolar_choi}')
```

```
>>> A quantum channel is a quantum netowrk of the form J[2 -> 2]
```

One may apply a quantum channel to a quantum state, or compose two quantum channels, using the `@` operator.

```python
new_state = depolar_choi @ depolar_choi @ state_choi
```

## Example

For 3-dimensional systems, an unital channel may not be a mixed unitary channel.

> Example 4.3 in (Watrous, John. The theory of quantum information. Cambridge university press, 2018.)

```python
A1 = np.array([
[0,0,0],
[0,0,1/np.sqrt(2)],
[0,-1/np.sqrt(2),0],
])
A2 = np.array([
[0,0,1/np.sqrt(2)],
[0,0,0],
[-1/np.sqrt(2),0,0],
])
A3 = np.array([
[0,1/np.sqrt(2),0],
[-1/np.sqrt(2),0,0],
[0,0,0],
])

Choi1 = QuantumNetwork(A1, (3,3), pure=True) * 3
Choi2 = QuantumNetwork(A2, (3,3), pure=True)*3
Choi3 = QuantumNetwork(A3, (3,3), pure=True)*3
```

The three channels are pure but not unital. Which means they are not unitary.

```python
print(f"Choi1 is unital: {Choi1.unital()}")
print(f"Choi2 is unital: {Choi2.unital()}")
print(f"Choi3 is unital: {Choi3.unital()}")
```

```
>>> Choi1 is unital: False
Choi2 is unital: False
Choi3 is unital: False
```

However, the mixture of the three operators is unital.
As the matrices are orthogonal, they are the extreme points of the convex set of the unital channels.
Therefore, this mixed channel is not a mixed unitary channel.

```python
Choi = Choi1/3 + Choi2/3 + Choi3/3
print(f"The mixed channel is unital: {Choi.unital()}")
```
Loading
Loading