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.

Example code

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.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

qiskit_quimb-0.0.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qiskit_quimb-0.0.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for qiskit_quimb-0.0.2.tar.gz
Algorithm Hash digest
SHA256 fa245b53d2d9278e843671002d4a27bc5e37aeb2ddd124f0f87efa1072064618
MD5 2fb8fe3a8b5ca752c2fcd252fc569eaa
BLAKE2b-256 57c28834139427d14b920b549444a10ea257d355da34ffe7fc468a50238aeca5

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: qiskit_quimb-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for qiskit_quimb-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 97c2edd16676e04c7d3e371c8beb8d17cecffd44141ddaefdc9d1017e85b4012
MD5 9c7879dadaa7cc8338aa0375e57f0788
BLAKE2b-256 a01f9b92f1c562f7030276a547310ddef4980043173f2f94369dca515e7adf70

See more details on using hashes here.

Provenance

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