qiskit-research icon indicating copy to clipboard operation
qiskit-research copied to clipboard

Cost function using virtual qubits

Open miamico opened this issue 1 year ago • 0 comments

When trying to get the error for qubits used by the CX gate the code below assumes that the layout is virtual and it will raise errors with certain layouts for physical qubits.

https://github.com/qiskit-research/qiskit-research/blob/f4c1fe929d1e865a7c01fc85f85207a3a966aaff/qiskit_research/utils/cost_funcs.py#L54

The correct version would be:

fid *= (1-props.gate_error('cx', [layout[q0], layout[q1]]))

where layout is one of the matching layouts for the circuit. this is how it is handled in the original cost function code in mapomatic: https://github.com/Qiskit-Partners/mapomatic/blob/965ad30f20482fc14984cde371d5e1ab6b8335db/mapomatic/layouts.py#L210

miamico avatar Oct 27 '22 18:10 miamico