Skip to content
This repository has been archived by the owner on Jun 12, 2023. It is now read-only.

CTMP mitigator works only for circuits with even number of qubits #562

Open
HwajungKang opened this issue Mar 12, 2021 · 1 comment
Open
Labels
bug Something isn't working

Comments

@HwajungKang
Copy link

Informations

  • Qiskit Ignis version: latest
  • Python version:
  • Operating system:

What is the current behavior?

Applying CTMP mitigator on circuits with odd number of qubits makes expectation value worse rather than making it closer to the ideal value. works opposite to error mitigation. It behaves right for the circuits with even number of qubits, though. You can check with the code below by changing the variable n_q for the number of qubits.

Steps to reproduce the problem

import numpy as np
from qiskit import *
from qiskit.providers.aer.noise import NoiseModel
from qiskit.ignis.mitigation import (expval_meas_mitigator_circuits,
                                     ExpvalMeasMitigatorFitter,
                                     expectation_value)
from qiskit.test.mock import FakeMelbourne


###################

def circ(n_q):
    
    qc = QuantumCircuit(n_q)
    qc.h(0)
    qc.cx(range(n_q-1), range(1, n_q))
    qc.measure_all()
    
    return qc

####################

sim = Aer.get_backend('qasm_simulator')
backend = FakeMelbourne()


n_q = 7 # number of qubits

qc = circ(n_q)
counts_raw = execute(qc, backend, shots=8192).result().get_counts()

circ_ctmp, data_ctmp = expval_meas_mitigator_circuits(n_q, method='CTMP')
result_ctmp = execute(circ_ctmp, backend, shots=8192).result()
ctmp_mitigator = ExpvalMeasMitigatorFitter(result_ctmp, data_ctmp).fit()

counts_ideal = execute(qc, sim, shots=8192).result().get_counts()

ideal = i1nt(expectation_value(counts_ideal)[0])
raw = expectation_value(counts_raw)[0]
mitigated = expectation_value(counts_raw, meas_mitigator=ctmp_mitigator)[0]

print('Ideal expectation value: {}'.format(ideal))
print('Raw expectation value: {}'.format(raw))
print('CTMP mitigated expectation value: {}'.format(mitigated))

What is the expected behavior?

Suggested solutions

@HwajungKang HwajungKang added the bug Something isn't working label Mar 12, 2021
@chriseclectic
Copy link
Collaborator

@georgesbarron Do you have any ideas for this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants