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

Code block in is_separable #611

Merged
merged 3 commits into from
Jun 1, 2024
Merged
Changes from all commits
Commits
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
14 changes: 12 additions & 2 deletions toqito/state_props/is_separable.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,26 @@ def is_separable(state: np.ndarray, dim: None | int | list[int] = None, level: i
We provide the input as a denisty matrix :math:`\rho`.

On the other hand, a random density matrix will be an entangled state (a separable state).

>>> import numpy as np
>>> from toqito.rand import random_density_matrix
>>> from toqito.state_props import is_separable
>>> rho_separable = np.array([[1, 0, 1, 0],
... [0, 1, 0, 1],
... [1, 0, 1, 0],
... [0, 1, 0, 1]])
>>> rho_random = random_density_matrix(4)
>>> is_separable(rho_separable)
True
>>> is_separable(rho_random)

>>> rho_not_separable = np.array([[ 0.13407875+0.j , -0.08263926-0.17760437j,
... -0.0135111 -0.12352182j, 0.0368423 -0.05563985j],
... [-0.08263926+0.17760437j, 0.53338542+0.j ,
... 0.19782968-0.04549732j, 0.11287093+0.17024249j],
... [-0.0135111 +0.12352182j, 0.19782968+0.04549732j,
... 0.21254612+0.j , -0.00875865+0.11144344j],
... [ 0.0368423 +0.05563985j, 0.11287093-0.17024249j,
... -0.00875865-0.11144344j, 0.11998971+0.j ]])
>>> is_separable(rho_not_separable)
False

References
Expand Down