Skip to main content

Simulate Qiskit circuits using quimb

Project description

qiskit-quimb

Simulate Qiskit circuits using quimb.

Installation

pip install qiskit-quimb

Usage

The qiskit_quimb module exposes two functions:

  • quimb_circuit: Converts a Qiskit circuit to a quimb circuit. This is probably the function you want to use.
  • quimb_gates: Converts a Qiskit circuit to a list of quimb gates, which is a bit more flexible.

Code example

import quimb.tensor
from qiskit.circuit import QuantumCircuit, QuantumRegister
from qiskit_quimb import quimb_circuit

# Build a Qiskit circuit
qubits = QuantumRegister(2)
circuit = QuantumCircuit(qubits)
a, b = qubits
circuit.h(a)
circuit.cx(a, b)

# Convert it to a quimb circuit
quimb_circ = quimb_circuit(circuit)

# Sample 10 bitstrings
samples = list(quimb_circ.sample(10, seed=1234))
print(samples)

# You can specify the quimb Circuit subclass and keyword arguments for the constructor
quimb_circ = quimb_circuit(
    circuit, quimb_circuit_class=quimb.tensor.CircuitMPS, max_bond=20
)
samples = list(quimb_circ.sample(10, seed=1234))
print(samples)
['00', '00', '11', '00', '11', '00', '11', '00', '11', '11']
['11', '11', '00', '00', '11', '00', '11', '11', '11', '00']

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qiskit_quimb-0.0.5.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

qiskit_quimb-0.0.5-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file qiskit_quimb-0.0.5.tar.gz.

File metadata

  • Download URL: qiskit_quimb-0.0.5.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for qiskit_quimb-0.0.5.tar.gz
Algorithm Hash digest
SHA256 056d63abe8b18b0b16e286809bd75002009333b40fc1f8b3bb8e00a720991155
MD5 a75806390d5374e9ce75bdc81d424b94
BLAKE2b-256 6f445b41d37b71ec63d23787ce37ef3a1e2d1c4bbea2485c4aa1d16c4d77b737

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_quimb-0.0.5.tar.gz:

Publisher: publish-to-pypi.yml on qiskit-community/qiskit-quimb

Attestations:

File details

Details for the file qiskit_quimb-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for qiskit_quimb-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 1d1915a6800097ad56b17f3c96ca2a9ee9e41246b381f99b11ccfe04e38ff16e
MD5 dde468e3a3794f40dad5a0ee2651bf58
BLAKE2b-256 4e206499a8b5a59d26b9334f6886c34f42c14892ae4e1ecacab0aa19ba8b79b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for qiskit_quimb-0.0.5-py3-none-any.whl:

Publisher: publish-to-pypi.yml on qiskit-community/qiskit-quimb

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page