I'm trying to use Qiskit's built in transpiler passes to do the following. I would like to take a quantum circuit and allocate the logical qubits to physical qubits.
The tutorial doesn't really explain how to do this. I would like to use one of the preset passes (TrivialLayout
, DenseLayout
, etc) to get this allocation.
from qiskit import QuantumCircuit
from qiskit.compiler import transpile
from qiskit.transpiler import PassManager, passes
from qiskit.test.mock import FakeMelbourne # NB will need to install dev requirements
""" This is the circuit we are going to look at"""
qc = QuantumCircuit(13, 13)
qc.h(3)
qc.cx(0,6)
qc.h(1)
qc.cx(6,0)
qc.cx(0,1)
qc.cx(3,1)
qc.h(3)
qc.cx(3,0)
qc.measure_all()
backend = FakeMelbourne()
properties = backend.properties()
coupling_map = backend.configuration().coupling_map
The output of the program should be a dictionary or something that gives tells me which physical qubit each logical qubit is mapped to. How can I do this?