Finding Entanglement Rank
Project description
Ranken
Finding entanglement rank
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)])
proj, proj_perp = Projector(basis=subspace_basis)
# optionally pass gs=True to run Gram-Schmidt on 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
Release history Release notifications | RSS feed
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.3.tar.gz
(3.2 kB
view details)
Built Distribution
File details
Details for the file ranken-0.0.3.tar.gz
.
File metadata
- Download URL: ranken-0.0.3.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e9c10e3fef905a524dd5f1c19cb67152487b54541d8bf18bbc4e68ab88e1ddd |
|
MD5 | 86b5f7a57463b21ae3c7d6c69281908a |
|
BLAKE2b-256 | cdb50174d552edc17d5a6128cf3f3301a45f36509e0587b640354036183e1529 |
File details
Details for the file ranken-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: ranken-0.0.3-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f147db196ab14401a084773ea25cad84c80cda2f790be21494ee53e32a4b5b5 |
|
MD5 | 1150a2a8744e7c2361f3ed7ec9648c19 |
|
BLAKE2b-256 | b9bed4fa38d26a64aef26618f4319a2e5bd3da16a934917163037eae6e766b32 |