A quantum computing library for the rest of us
Project description
Qublets
Qublets is an approachable Quantum Computing Library written in Python using Intel's intel-qs Quantum Computing Simulator. The goal of the library is to make introductory quantum computing approachable at the undergraduate (or lower) level.
Setup
Qublets is supposed to eliminate the hassle most other quantum computing libraries come with, but the setup is still a work in progress.
You will need Anaconda installed to proceed. Verify successful installation by checking that which python
returns an anaconda path prior to attempting any qublets (intel-qs) setup.
If you're on Unix (including OS X), you should be able to get going by running manual-setup.sh
and waiting a while. If you're on Windows, you can still do that by using WSL (highly recommended).
If you'd like to DIY, simply follow the build instructions for intel-qs. Qublets is a python3 wrapper around it.
Getting Started
Qublets makes it easy to run simple quantum examples. Consider the classic "Superposition qubit" case:
from qublets import QUInt
result = QUInt.zeros(1).hadamard().measure()
print(result)
As you can see, Qublets aims to be as readable as possible (although you can customize quite a bit later). Running the code above will yield a 1
50% of the cases and a 0
the rest. That's it. You may also notice (most) Qublets operators are chainable and will return the object they operated on - this makes building circuits a breeze.
If you're familiar with quantum state names, you can make the above example even shorter by using a |+〉
state:
from qublets import QUInt
result = QUInt.pluses(1).measure()
print(result)
You may have noticed Qublets supports integers natively - in fact, it supports both unsigned and signed integers of any given size (that your computer can work with without combusting in flames). The example above easily generalizes to a 4-bit QInt:
from qublets import QInt
result = QInt.pluses(4).measure()
print(result)
Now, you'd instead get a (mostly) uniformly random number between -8
and 7
.
It wouldn't really be a quantum computing library if we didn't entangle some bits so let's do that quickly:
from qublets import QUInt
q1 = QUInt.zeros(2)
q1[0].hadamard()
q1[1].c_negate(on=q1[0])
print(q1.measure())
# Or, just like before, we can use a shortcut
print(QUInt.fully_entangled(2).measure())
If you're familiar with quantum computing's ABCs, you'd likely be happy to see only 0
and 3
as the possible values of the measurements. That's because the classic had
/cnot
combo will give us a perfect |Φ+〉
state (a bell pair) to work with. fully_entangled
, on the other hand, will always entangle all the bits in a QInt
using a chain of cnot
s - which would be equivalent for only 2 bits.
Qublets also supports cross-q(u)int operations, built-in primitives, batch runs for your circuits, extracting probability amplitudes and more - you can find some inspirational samples in docs/examples/
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
Built Distributions
Hashes for qublets-0.1.2-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56b4c5ea997b56d255921e6ccce2142e7ef49d029463c861282843a10f5d0904 |
|
MD5 | 04c88c606ec3cb6e1d5e64d4bd19dc70 |
|
BLAKE2b-256 | 9643b1d5d20b73e3640aeb8f8376447a83fa553d973cc4850f2aaf9f43a49f75 |
Hashes for qublets-0.1.2-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa3898d9a615abdc8a4ab96f7befb168f714c2bbebd2d242535a5d7ee94a220a |
|
MD5 | ac377146404d5e289cddffa7a4e62eea |
|
BLAKE2b-256 | d9a9026e426d3fe841b015418f774da95bee397f9461b03e651001ceb8c35666 |
Hashes for qublets-0.1.2-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2474dd889f1f889f956a2a58e70a5ac0baf6d4be7b06b3f8977cef10130f6633 |
|
MD5 | 1c3c7821e2a295d5a2937ddbf281fbf4 |
|
BLAKE2b-256 | 476bab045e4265bd78be217e1a01587969109787736441d49d3c12fa57ba5a79 |
Hashes for qublets-0.1.2-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98f65d099b6a9aa74e7ff97acfb94c5d1620aedcd290190d835a734c46362576 |
|
MD5 | 9c0dbdb1dd2a87398fdbef07a447b06e |
|
BLAKE2b-256 | 0747635b9be520f3295967cf9ecda8bd65af4c66d8db132279a95b3e56372558 |
Hashes for qublets-0.1.2-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de60cbe87c957b4a7d33c3b2f0cba60cbe8836a61a2fc6fdcdf215ba335f5735 |
|
MD5 | c18b10ac45a88feacf3996a81a0ec3cb |
|
BLAKE2b-256 | 00a2eca1ca0998b41f9a6eb831b6a5691c77ba9f9ef843ee61dc7cc4b9117bac |