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%Rn])
  B = State.create(State.Ket_1, basis[(i+1)%Rn])

  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))
  # Multiple phis can be done with
  # PHI_rx = State.combine([phi_rx1, phi_rx2, phi_rx3], [1, 1, 1])

  return Loss(PHI_rx, proj_perp)

# minima accepts all the arguments of scipy.optimize.minimize
res = minima(f, rand(R_MAX, size), tries=2)
print(f'E_r(θ={THETA:.2f}) = {res:.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.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

ranken-0.0.2-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ranken-0.0.2.tar.gz
Algorithm Hash digest
SHA256 506904cfa022607c8032d95cd2e09cf3a888f29e37cbc04be687a98dcbf87d9e
MD5 0e68ac0298e7bbf655f8c99dfc06c8ce
BLAKE2b-256 4ba2d42289b7ab781d67ed7fd940c7290f81fdef3f7f2598ccea37705fdbd064

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ranken-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fbeb6d32f9d9b06146485c50ef48f676ba35b9b2db9c0e3d4a8ec47ff32c6b3d
MD5 718bff7f74142a715480e5fa04e09596
BLAKE2b-256 4eff55423ad3f5db005002103594912a19e866b98adce2d059cee3642892c02a

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