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.2.tar.gz
(311.9 kB
view details)
Built Distribution
guppylang-0.12.2-py3-none-any.whl
(151.1 kB
view details)
File details
Details for the file guppylang-0.12.2.tar.gz
.
File metadata
- Download URL: guppylang-0.12.2.tar.gz
- Upload date:
- Size: 311.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78eb12eff2891f0ad11d68fd5318afe597cface072cb3f3ab180ab8f9eff6efc |
|
MD5 | 7ea2644e7304318f4e5819d0b7d5374d |
|
BLAKE2b-256 | 8f15d5858dee66874c608c02f92b29bbe4031cb5b7004c3e11958f3fc2e519ab |
File details
Details for the file guppylang-0.12.2-py3-none-any.whl
.
File metadata
- Download URL: guppylang-0.12.2-py3-none-any.whl
- Upload date:
- Size: 151.1 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 | 066c6e347769fab992360ed8fdb3b68176db6b925caf4b7ae073dbd8025d06f7 |
|
MD5 | 639b6371442653907ae2a9aed60305ce |
|
BLAKE2b-256 | 724fc50cfa8eeb553138c5a5b32f7f989f50ffb69e43723b3a798db3e055b0d6 |