Skip to main content

Finding Entanglement Rank

Project description

Ranken

Finding entanglement rank

PyPI version

Usage

After pip install ranken, you can use the package as follows:

Create a State

from ranken.core import State

Rn = 3
theta = np.pi/2

basis = np.eye(Rn)
def PSI(i):
  A = State.create(State.Ket_0, basis[i%l])
  B = State.create(State.Ket_1, basis[(i+1)%l])

  return State.combine([A, B], [np.cos(theta/2), np.sin(theta/2)])

Make Projectors

from ranken.core import Projector

subspace_basis = np.array([PSI(i) for i in range(2)])
# subspace_basis = GramSchmidt(subspace_basis)

proj, proj_perp = Projector(basis=subspace_basis)

Find Rank

from ranken.utils import Loss, rand, minima
from ranken.core import Qdit

size = (2*D + 1)*(r - 1)
def phi_ik(X):
  lmda = X[0]
  qubit = Qdit(2, X[1:5].reshape(2, 2))
  qutrit = Qdit(3, X[5:11].reshape(3, 2))

  return lmda, qubit, qutrit

def f(X):
  L, qbit, qtrit = phi_ik(X)
  PHI_rx = normalise(L * np.kron(qbit, qtrit))

  return Loss(PHI_rx, proj_perp)

res = minima(f, rand(R_MAX, size))
print(f'E_r(θ={THETA:.2f}) = {res.fun:.4f}')

Dev

python3 test.py

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ranken-0.0.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

ranken-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file ranken-0.0.1.tar.gz.

File metadata

  • Download URL: ranken-0.0.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for ranken-0.0.1.tar.gz
Algorithm Hash digest
SHA256 b7ca7fa9dcca643ea92a51aa04061ead8387dfba3bffbba3443411e0fef2ffc6
MD5 e9727929dc3b422313e1fb1c02576f36
BLAKE2b-256 68fd668d79ef67ba834b44bccb566b63b74d8a156828ddd01a1571a747d8e99e

See more details on using hashes here.

File details

Details for the file ranken-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: ranken-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.14

File hashes

Hashes for ranken-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab29c662f48b17963f9c50b693caef92cff670685e373c91de3584d3da52ff34
MD5 7adf18ea7925a72796e59e4a0c6c394f
BLAKE2b-256 7af26d11a81d735afefad5e0b39029475afc55fab43ddfa4614e8c81428bf61c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page