Skip to main content

Module virtual_permutation

Module virtual_permutation 

Source
Expand description

Pre-layout elimination of logical wire permutations.

A logical SWAP does not need to become a physical operation when layout is still free to choose where logical outputs reside. This transform removes eligible SWAP operations, redirects every later operation to the wire that carries the corresponding logical state, and returns an explicit output permutation for composition with routing metadata.

The direction of VirtualPermutation is part of the API contract:

original logical output -> rewritten circuit output wire

If routing later reports a layout from rewritten outputs to physical qubits, VirtualPermutation::compose_final_layout produces the complete original-output-to-physical mapping.

Structs§

VirtualPermutation
Output-wire permutation accumulated while logical SWAPs are removed.
VirtualPermutationElisionResult
Result of elide_virtual_permutations.

Enums§

VirtualPermutationElisionStatus
Coarse disposition of a virtual-permutation elimination attempt.

Functions§

elide_virtual_permutations
Removes eligible top-level logical SWAPs and returns their output mapping.