Closed t-imamichi closed 9 months ago
Fixes #188 Fixes #197
from qiskit import QuantumCircuit from qiskit_aer import AerSimulator from mthree import M3Mitigation def run(qc, backend, shots, method): mit = M3Mitigation(backend) qubits = range(qc.num_qubits) mit.cals_from_system(qubits) result = backend.run(qc, shots=shots).result() raw_counts = result.get_counts() quasi, details = mit.apply_correction(raw_counts, qubits, details=True, method=method) return details["time"], details["method"] if __name__ == "__main__": n = 20 shots = 10000 qc = QuantumCircuit(n, n) qc.h(range(n)) qc.measure_all(add_bits=False) backend = AerSimulator() time, method = run(qc=qc, backend=backend, shots=shots, method="auto") print(f"num_qubits: {n}, shots: {shots} -> time: {time}")
main
num_qubits: 20, shots: 10000 -> time: 12.706861458020285
this PR
num_qubits: 20, shots: 10000 -> time: 4.631123083003331
Fixes #188 Fixes #197
main
this PR