BGLS
BGLS is a Python package that implements the Bravyi, Gosset, and Liu Sampling algorithm presented in How to simulate quantum measurement without computing marginals (Phys. Rev. Lett.) (arXiv) for Cirq circuits.
Quickstart
Installation
pip install bgls
Example
import cirq
import bgls
# Example circuit to run.
qubits = cirq.LineQubit.range(2)
circuit = cirq.Circuit(
cirq.H.on(qubits[0]),
cirq.CNOT.on(*qubits),
cirq.measure(*qubits, key="z")
)
# Run the circuit with BGLS.
simulator = bgls.Simulator(
initial_state=cirq.StateVectorSimulationState(qubits=qubits, initial_state=0),
apply_op=cirq.protocols.act_on,
compute_probability=bgls.born.compute_probability_state_vector,
)
results = simulator.run(circuit, repetitions=10)
print(results.histogram(key="z"))
Sample output:
Counter({0: 6, 3: 4})
Documentation
See more details and examples in the Documentation for BGLS.
Metadata
Release files for bgls 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| bgls-0.2.0.tar.gz | 19.0 kB | Without provenance | Details for bgls-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bgls-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for bgls-0.2.0-py3-none-any.whl |
Total release size: 44.4 kB
Release files / bgls-0.2.0.tar.gz
| Download URL | bgls-0.2.0.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
488235be47e9b733c52d57207b18ad6cae5c3ec1ce797da96eb87ea589b4d859
|
|
BLAKE2b-256 checksum How to use checksums |
09ce686abb156b6712b97787ccf1406017444785b60f641d8de5328ee5ba01af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / bgls-0.2.0-py3-none-any.whl
| Download URL | bgls-0.2.0-py3-none-any.whl |
|---|---|
| Size | 25.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
535087493af4fd6c95fd5b89aea6c3e98b8c68d2262be50fb08e0976c16e4fb1
|
|
BLAKE2b-256 checksum How to use checksums |
bcd7f2f19c5d33fd742ab0703a2eaf72e97af28aea23acb40a660ebfb3f84f13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for bgls 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.