The question concerns logical to physical qubit mapping when compiling quantum circuits with BQSKit. In Qiskit, I can specify the initial layout for the transpilation. It is also possible to retrieve the final layout. With Qiskit Transpiler and BQSKit Compiler, the final layout generally differs from the initial layout because the compiler can permute logical qubits. My question is whether I can specify the initial layout
and retrieve the final layout
with BQSKit.
I found the following way to retrieve the final layout:
1. Add measurements on all active qubits of a Qiskit circuit.
2. Compile the circuit with BQSKit.
3. Translate back to Qiskit and draw.
4. Read out the mapping from the positions of final measurements.
5. Notice that q1 and q2 are permuted at the end.
However, I am interested in a programmatic solution.