Skip to content

Commit

Permalink
autoapi/channel_ops/partial_channel/index
Browse files Browse the repository at this point in the history
  • Loading branch information
purva-thakre committed Feb 9, 2024
1 parent e301cb4 commit b3cf766
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions toqito/channel_ops/partial_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,33 +36,45 @@ def partial_channel(
The following applies the completely depolarizing channel to the second
subsystem of a random density matrix.
>>> import numpy as np
>>> from toqito.channel_ops import partial_channel
>>> from toqito.channels import depolarizing
>>> rho = np.array([
... [0.3101, -0.0220-0.0219*1j, -0.0671-0.0030*1j, -0.0170-0.0694*1j],
... [-0.0220+0.0219*1j, 0.1008, -0.0775+0.0492*1j, -0.0613+0.0529*1j],
... [-0.0671+0.0030*1j, -0.0775-0.0492*1j, 0.1361, 0.0602 + 0.0062*1j],
... [-0.0170+0.0694*1j, -0.0613-0.0529*1j, 0.0602-0.0062*1j, 0.4530]])
>>> phi_x = partial_channel(rho, depolarizing(2))
[[ 0.20545+0.j 0. +0.j -0.0642 +0.02495j 0. +0.j ]
[ 0. +0.j 0.20545+0.j 0. +0.j -0.0642 +0.02495j]
[-0.0642 -0.02495j 0. +0.j 0.29455+0.j 0. +0.j ]
[ 0. +0.j -0.0642 -0.02495j 0. +0.j 0.29455+0.j ]]
>>> partial_channel(rho, depolarizing(2))
array([[ 0.20545+0.j , 0. +0.j , -0.0642 +0.02495j,
0. +0.j ],
[ 0. +0.j , 0.20545+0.j , 0. +0.j ,
-0.0642 +0.02495j],
[-0.0642 -0.02495j, 0. +0.j , 0.29455+0.j ,
0. +0.j ],
[ 0. +0.j , -0.0642 -0.02495j, 0. +0.j ,
0.29455+0.j ]])
The following applies the completely depolarizing channel to the first
subsystem.
>>> import numpy as np
>>> from toqito.channel_ops import partial_channel
>>> from toqito.channels import depolarizing
>>> rho = np.array([[0.3101, -0.0220-0.0219*1j, -0.0671-0.0030*1j, -0.0170-0.0694*1j],
>>> [-0.0220+0.0219*1j, 0.1008, -0.0775+0.0492*1j, -0.0613+0.0529*1j],
>>> [-0.0671+0.0030*1j, -0.0775-0.0492*1j, 0.1361, 0.0602 + 0.0062*1j],
>>> [-0.0170+0.0694*1j, -0.0613-0.0529*1j, 0.0602-0.0062*1j, 0.4530]])
>>> phi_x = partial_channel(rho, depolarizing(2), 1)
[[0.2231+0.j 0.0191-0.00785j 0. +0.j 0. +0.j ]
[0.0191+0.00785j 0.2769+0.j 0. +0.j 0. +0.j ]
[0. +0.j 0. +0.j 0.2231+0.j 0.0191-0.00785j]
[0. +0.j 0. +0.j 0.0191+0.00785j 0.2769+0.j ]]
... [-0.0220+0.0219*1j, 0.1008, -0.0775+0.0492*1j, -0.0613+0.0529*1j],
... [-0.0671+0.0030*1j, -0.0775-0.0492*1j, 0.1361, 0.0602 + 0.0062*1j],
... [-0.0170+0.0694*1j, -0.0613-0.0529*1j, 0.0602-0.0062*1j, 0.4530]])
>>> partial_channel(rho, depolarizing(2), 1)
array([[0.2231+0.j , 0.0191-0.00785j, 0. +0.j ,
0. +0.j ],
[0.0191+0.00785j, 0.2769+0.j , 0. +0.j ,
0. +0.j ],
[0. +0.j , 0. +0.j , 0.2231+0.j ,
0.0191-0.00785j],
[0. +0.j , 0. +0.j , 0.0191+0.00785j,
0.2769+0.j ]])
References
==========
Expand Down

0 comments on commit b3cf766

Please sign in to comment.