Skip to content

bloqade.gemini.common.dialects.arrange.permute

← Module overview

functionpermutesource

bloqade.gemini.common.dialects.arrange.permute

def permute(qubits, perm, insert_moves=False) -> None

Permute qubits — a logical relabel where qubits[i] ends up referring to what was qubits[perm[i]].

perm must be a compile-time-constant permutation of range(len(qubits)). insert_moves (compile-time constant) selects how the permutation is realized:

  • False (default): relabel only — no atoms move; the qubit references are permuted (the quantum information is permuted for free). A later transversal move absorbs the physical permutation (a “lazy” permutation). Valid under any strategy, including palindrome.
  • True: also commit the moves — physically route the atoms so the permutation is realized in place now (e.g. to keep a QEC code block physically arranged to match the new labels). Only valid under a non-palindrome (no-return) strategy; PalindromePlacementStrategy rejects it, since it would return the committed moves home.

Parameters

NameTypeDefaultDescription
qubits—required
perm—required
insert_moves—False
source