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 hashes)
Built Distribution
Close
Hashes for qiskit_quimb-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 174147d818dde610bacce0cc33125f1e66ae5c3ebf7429110e5e2ed1dad813ad |
|
MD5 | 94d1ed927eb95522095451cc427e430f |
|
BLAKE2b-256 | bb74fafc76f0ce86538160295a922d1d132f3e813810a912110bc814e3fc2c62 |