Simulate Qiskit circuits using quimb
Project description
qiskit-quimb
Simulate Qiskit circuits using quimb.
Example code
import quimb.tensor
from qiskit.circuit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import CPhaseGate, PhaseGate, XGate, XXPlusYYGate
from qiskit_quimb import quimb_circuit
# Build a Qiskit circuit
qubits = QuantumRegister(3)
circuit = QuantumCircuit(qubits)
a, b, c = qubits
circuit.append(XGate(), [a])
circuit.append(XXPlusYYGate(0.5, 0.5), [a, b])
circuit.append(CPhaseGate(0.1), [b, c])
circuit.append(PhaseGate(0.1), [c])
circuit.append(XXPlusYYGate(0.5, 0.5), [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)
['100', '010', '010', '100', '100', '100', '010', '100', '100', '100']
['100', '100', '100', '100', '100', '100', '010', '100', '010', '100']
Project details
Release history Release notifications | RSS feed
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.0.tar.gz
(7.3 kB
view details)
Built Distribution
File details
Details for the file qiskit_quimb-0.0.0.tar.gz
.
File metadata
- Download URL: qiskit_quimb-0.0.0.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98d1690db31906234ca4fd9d201d16511274647d6838bcfe736ba38181c4d068 |
|
MD5 | 4f35763e3f31bcaf932c44dd5174ee3e |
|
BLAKE2b-256 | ea4ee5156a20a589decdc6b2d71b7bd61fedaf2f676e56e72916412060492e81 |
File details
Details for the file qiskit_quimb-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: qiskit_quimb-0.0.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 174147d818dde610bacce0cc33125f1e66ae5c3ebf7429110e5e2ed1dad813ad |
|
MD5 | 94d1ed927eb95522095451cc427e430f |
|
BLAKE2b-256 | bb74fafc76f0ce86538160295a922d1d132f3e813810a912110bc814e3fc2c62 |