Skip to main content

Quantum computing with qudits

Project description

Qudit

Simulations for Qudit systems

PyPI version

Usage

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

Usage

Two qubit example: bell state

from qudit import *
D = DGate(2) # create gateset for 2-dits

# p = |00><00|
p00 = Psi(Dit(2, 0), Dit(2, 0)).density()

H_x_I = D.H ^ np.eye(2) # H x I
rho = D.CX | H_x_I | p00 # rho - H x I - CX
print(rho)

# Tr(|11><11| p)
prob = Tr(Psi(2, "11").density().dot(rho))
print(prob) # 0.5

Three Qutrit example: 3-GHZ state = $\frac{1}{\sqrt{3}}(|000\rangle + |111\rangle + |222\rangle)$

from qudit import *

P000 = Psi(Dit(3, 0), Dit(3, 0), Dit(3, 0))
P111 = Psi(Dit(3, 1), Dit(3, 1), Dit(3, 1))
P222 = Psi(Dit(3, 2), Dit(3, 2), Dit(3, 2))

GHZ = Dit(P000, P111, P222)

# alternative way to create GHZ state
P000 = Psi(3, "000")
P111 = Psi(3, "111")
P222 = Psi(3, "222")

GHZ = Dit(P000, P111, P222)

print(GHZ.density())

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

qudit-0.0.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

qudit-0.0.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for qudit-0.0.2.tar.gz
Algorithm Hash digest
SHA256 40510d85aa2593bb0094d8654da3b98e928ce109ff626b9e2f518288b7635419
MD5 c3480297a8897ecbdf2a9f835a4b76c2
BLAKE2b-256 423874ed4bfbd6e6ec2b9687b009c773b9558b512b53a0f8f2df5b2009a88e84

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for qudit-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d9fd300f90abb28e13d292facdc5ce9ee7aa7db2d801d0c5c847491fb1329457
MD5 4f20c3f1f322c641d11ed56697233a34
BLAKE2b-256 2307691203b869543a9b472d88eb47d73ea20287318930c0387bdb8eeee9881c

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