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

Uploaded Source

Built Distribution

qiskit_quimb-0.0.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: qiskit_quimb-0.0.3.tar.gz
  • Upload date:
  • Size: 6.8 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.3.tar.gz
Algorithm Hash digest
SHA256 8e596c5d16bbe76d359d98052542df88fbe6b004414feec4d20b77b0984c375b
MD5 e47e483f8227306ba8eef881127a111c
BLAKE2b-256 74b567dd0cd26368c62eb46548e0dedf7c8206e81f24c6193a5e7a798bb93a9e

See more details on using hashes here.

Provenance

File details

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

File metadata

  • Download URL: qiskit_quimb-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for qiskit_quimb-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c1516b5503cbe57bbaaa2c3232137a4a4d41f5d124392b7a5e7664add1123b01
MD5 56e88be014b1f58029abc0699d8986ac
BLAKE2b-256 35fcd8ff6b4dbeabc10d633023d21bebfdb12649991461ff97a148635b8ffa20

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