Read QASM
Last modified: 2023-03-26
QASM (Quantum Assembly Language) is a language used to program quantum computers. It is similar in concept to assembly language used in classical computers, but instead of operating on bits, QASM operates on quantum bits (qubits).
Install Qiskit
pip install oqi qiskit
Read QASM
from qiskit import QuantumCircuit, transpile
from qiskit.providers.aer import QasmSimulator
from qiskit.visualization import plot_histogram
simulator = QasmSimulator()
circuit = QuantumCircuit.from_qasm_file('example.qasm')
compiled_circuit = transpile(circuit, simulator)
job = simulator.run(compiled_circuit, shots=1000)
result = job.result()
counts = result.get_counts(compiled_circuit)
print(counts)