Qiu Qiskit Encore
Improvements of the native types of Qiskit, used by the other packages of this monorepo: statevectors validated as normalized states of qubits, and the synthesis methods choosing how a circuit building block is represented in a circuit. The contributors to this package believe that such tools should be part of the standard Qiskit library, or at least they can envision them being so. The circuit building blocks themselves, e.g. state preparation and the QFT, are in qiu-quantum-computing.
Installation
pip install qiu-qiskit-encore
Validated statevectors
statevector.validated_statevector(state) returns a copy of a Qiskit Statevector, or of amplitudes, as a complex Statevector, and raises a ValueError unless its dimension is a power of 2 of at least one qubit and it is normalized up to Qiskit's tolerances. States are never normalized silently.
Synthesis methods
synthesis_method.SynthesisMethod chooses how a circuit building block is represented in its circuit, by a method parameter:
| method | the circuit contains | use it for |
|---|---|---|
DENSE |
a single unitary gate defined by its dense matrix | exact reference results on few qubits (the matrix has 4**n entries) |
GATE |
a single high-level Qiskit gate, synthesized by Qiskit when transpiling | the default: leaving the synthesis to Qiskit, e.g. for hardware-aware transpiling |
DECOMPOSED |
an already decomposed circuit of elementary gates | a synthesis we control, where Qiskit's is not suitable |
It is an ExtendedEnum of qiu-python-encore, so its members compare equal to their raw values "dense", "gate" and "decomposed".
Usage
import numpy as np
from qiskit.quantum_info import Statevector
from qiu_qiskit_encore.statevector import validated_statevector
from qiu_qiskit_encore.synthesis_method import SynthesisMethod
# a copy of the amplitudes as a statevector, checked to be a normalized state of qubits
statevector = validated_statevector(np.array([0.6, 0.8j]))
assert statevector == Statevector([0.6, 0.8j])
# the synthesis methods compare equal to, and are constructed from, their raw values
assert SynthesisMethod("decomposed") is SynthesisMethod.DECOMPOSED
assert SynthesisMethod.GATE == "gate"
Documentation
The documentation, with the API reference from the docstrings, is built from docs/ with MkDocs and published at https://blackwild.github.io/qiu/qiu-qiskit-encore/. To serve it locally, from the repository root:
uv run mkdocs serve -f packages/qiu-qiskit-encore/mkdocs.yml
Tests
From the repository root:
uv run pytest packages/qiu-qiskit-encore
Release files for qiu-qiskit-encore 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qiu_qiskit_encore-0.1.0.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qiu_qiskit_encore-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.0 kB
Release files / qiu_qiskit_encore-0.1.0.tar.gz
| Download URL | qiu_qiskit_encore-0.1.0.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e13fc1e94a7595c6dc3aa039f6ebcbc9637f1309a1baf6d25a3a95bd3e2a88fc
|
|
BLAKE2b-256 checksum How to use checksums |
05e32e4fcb1d1d6999f099d1be7593a05b28a4706779c1a4d3f7c574cb76aabc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / qiu_qiskit_encore-0.1.0-py3-none-any.whl
| Download URL | qiu_qiskit_encore-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e31af3ce6d75ff9a465493dc03ff81c4686f56b9c600bd8820146940446eef8a
|
|
BLAKE2b-256 checksum How to use checksums |
7ae5ce6a622569c9f1c6cd13c5fd82b2ed78e0ac8ca0aa15035bb4f258ddd245
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.18 {"installer":{"name":"uv","version":"0.12.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|