Pythonic quantum-classical programming language
Project description
Guppy is a quantum programming language that is fully embedded into Python. It allows you to write high-level hybrid quantum programs with classical control flow and mid-circuit measurements using Pythonic syntax:
from guppylang import guppy
from guppylang.prelude.quantum import cx, h, measure, qubit, x, z
@guppy
def teleport(src: qubit, tgt: qubit) -> qubit:
"""Teleports the state in `src` to `tgt`."""
# Create ancilla and entangle it with src and tgt
tmp = qubit()
tmp, tgt = cx(h(tmp), tgt)
src, tmp = cx(src, tmp)
# Apply classical corrections
if measure(h(src)):
tgt = z(tgt)
if measure(tmp):
tgt = x(tgt)
return tgt
guppy.compile_module()
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
guppylang-0.12.1.tar.gz
(311.5 kB
view details)
Built Distribution
guppylang-0.12.1-py3-none-any.whl
(150.4 kB
view details)
File details
Details for the file guppylang-0.12.1.tar.gz
.
File metadata
- Download URL: guppylang-0.12.1.tar.gz
- Upload date:
- Size: 311.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f600a2307a8cb52a0cbd6c98ee06582ab483fd4c1bcdf2374035c5880834fc2b |
|
MD5 | f048a1e01aa530d5025834ab07a44258 |
|
BLAKE2b-256 | a32f05c6d7bc3c3432b9fc702558a8f79744dfd874a2f1ce86b9f0f16276830d |
File details
Details for the file guppylang-0.12.1-py3-none-any.whl
.
File metadata
- Download URL: guppylang-0.12.1-py3-none-any.whl
- Upload date:
- Size: 150.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62cb616670a0987583b7ab4dd8eb73177a309cb70ab864212af972ffb6562d6c |
|
MD5 | 14c4baeea1734391a6fc95b2618cfe6e |
|
BLAKE2b-256 | 7c5614b9b2893efc7022234d571232b1e1948ea99a54ca8f50ebdd0d4a5bb9bb |