Skip to main content

QOP

Make quantum operators and algebras native in python

Behold, the power of qop.

  • Boson
from qop.boson import *
assert (b0.D*b0)**3 == b0.D*b0+3*b0.D**2*b0**2+b0.D**3*b0**3
  • Fermion
from qop.fermion import *
assert (c0.D*c0)**3 == c0.D*c0
  • Hardcore Boson
from qop.hardcoreboson import *
assert (hb0.D*hb0)**2 ==hb0.D*hb0
assert hb0*hb1 == hb1*hb0
  • Spin
from qop.spin import *
assert s0.x*s0.y == 1j/2*s0.z
assert s0.z*s1.x == -2j*s1.x*s0.x*s0.y
  • Grassmann numbers
from qop.grassmann import *
assert (1+g(0)*g(1))**2 == 1+2*g(0)*g(1)
  • Quaternion numbers
from qop.quaternion import *
assert (1-qi)/(1-qj) == 0.5*(1-qi+qj-qk)
  • Symbols
from qop.symbol import *
a = Symbol("a")
assert np.conj(2+a).evaluate({"a": 1j}) == 2-1j
  • Quantum states
from qop.fermion import *
from qop.state import *
assert Sf("1").D | c1.D * c1 | c1.D | Sf() == 1.0

And mix all, we have

U = Symbol("U")
assert Sf("12").D | U * (np.array([c1.D, c2.D]) @ np.array([c1, c2])) ** 2 | Sf("12") == 4 * U

Or einsum with opt_einsum

from opt_einsum import contract
from qop.symbol import *
a,b,c,d = Symbols("abcd")
simplify(contract("ijk,i->jk", d*np.ones([3,3,3]), np.array([a,b,c])))

See more examples in tests.

Download files

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

Source Distribution

qop-0.0.2.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qop-0.0.2-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qop-0.0.2.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.3

File hashes

Hashes for qop-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fb7eafad7cd90f4a465d6deb19f1ca0c0b8daa9c537d04b5cb03ffd068d41f3e
MD5 64f442049661fa8f87c11a1c9773cfcf
BLAKE2b-256 7c6a8387d3f77252cf4e9689131953c004985c7b9d32dcca74e9e21f50884df1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: qop-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.45.0 CPython/3.6.3

File hashes

Hashes for qop-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 130bb8909d08ec4f099cfaec76320f19d9a705d7a9a2feae9ed79e08fd1bee4e
MD5 9527db14a3970b5322e8eb55f436568e
BLAKE2b-256 d3568182fa684d0dc249ced5c3a219f9ae4b34e898dc8dca504ccba3cc848111

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page