-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduling; physical circuits check #12419
Comments
Mostly for historical reasons, and for lack of a more formal distinction in the type system, Qiskit's current specification of "physical circuit" requires a single quantum register spanning the entire circuit whose name is specifically We're not meaningfully able to change that within deprecation polices within Qiskit 1.x, though making more formal typing for physical circuits / registers is something we are interested in in general - it's more convenient for both us and users, but the change does risk quite serious disruption to the existing ecosystem. There's no valid way to change the name of a register after creation; it's part of the hashing of registers, which are assumed to be immutable. The most immediate workaround for you (if there's no way to configure tket to leave the register names be) is likely to be to use the As an example of using those two transpiler passes (I'll use an input from qiskit.circuit import QuantumCircuit, QuantumRegister
from qiskit.transpiler import PassManager, Layout
from qiskit.transpiler.passes import SetLayout, ApplyLayout
tket_reg = QuantumRegister(3, "node")
# Or whatever the mapping is:
tket_to_physical = Layout({tket_qubit: i for i, tket_qubit in enumerate(tket_reg)})
# This assumes that the register is full width on the device. If not,
# you'll want `FullAncillaAllocation` and `EnlargeWithAncilla` too.
pm = PassManager([
SetLayout(tket_to_physical),
ApplyLayout(),
])
circuit = QuantumCircuit(tket_reg)
circuit.h(0)
circuit.cx(0, 1)
circuit.cx(1, 2)
physical = pm.run(circuit)
assert physical.qregs == [QuantumRegister(3, "q")] |
Thank you, @jakelishman, for your detailed answer; for now, your suggested trick works just fine. |
There is this stringent check on the naming of a quantum register during the scheduling process, leading to a
TranspilerError
.MWE:
TranspilerError: 'ASAP schedule runs on physical circuits only'
In our compiler tool, we make use of Qiskit as well as Tket optimization passes.
However, Tket internally renames the registers as "node"s.
qreg
name after initialisation (without accessing the private attribute_name
)?The text was updated successfully, but these errors were encountered: