Generate a bell state and visualize sampling results
Generate a bell state
# %pip install "quri-parts[braket,cirq,qiskit,qulacs,tket]"
from quri_parts.circuit import QuantumCircuit
from quri_parts.qulacs.sampler import create_qulacs_vector_sampler
from quri_parts.circuit.utils.circuit_drawer import draw_circuit
import matplotlib.pyplot as plt
from collections import Counter
# A circuit with 2 qubits
n_qubits = 2
circuit = QuantumCircuit(n_qubits)
circuit.add_H_gate(0)
circuit.add_CNOT_gate(0, 1)
draw_circuit(circuit)
#output
___
| H |
--|0 |-----●---
|___| |
_|_
|CX |
----------|1 |-
|___|