Synthesize a permutation circuit for a fully-connected architecture using sorting.
More precisely, if the input permutation is a cycle of length
m, then this creates a quantum circuit with
m-1SWAPs (and of depth
m-1); if the input permutation consists of several disjoint cycles, then each cycle is essentially treated independently.
pattern (Union[list[int], np.ndarray]) – permutation pattern, describing which qubits occupy the positions 0, 1, 2, etc. after applying the permutation. That is,
pattern[k] = mwhen the permutation maps qubit
k. As an example, the pattern
[2, 4, 3, 0, 1]means that qubit
2goes to position
4goes to position
the synthesized quantum circuit.
- Return type