Cost function using virtual qubits
Opened this issue · 0 comments
miamico commented
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.
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