Skip to content

workbench_algorithms.subroutines.permutations.bitonic_permutation

Qubricks which permute qubit registers.

BitonicPermutation

BitonicPermutation(**kwargs)

Bases: Qubrick

A routine that permutes qubit registers.

compute

compute(
    target_reg: Qubits,
    reg_size: int,
    register_permutation_function: Callable,
    ctrl: Qubits | int = 0,
)

Compute the circuit for the canonical swap-up-type permutation.

The sorting/permutation logic to perform a permutation of a register is independent of the particular quantum op used to effect a permutation. to use. This compute method exists so we can write down this logic just once and re-use it with your favorite "payload".

Parameters:

Name Type Description Default
target_reg (Qubits, list)

Register we apply the permutation to. This register can conceptually be interpreted as a single large register, or as several registers of equal size. To facilitate this dual use, we currently allow passing a list of Qubits objects (though this is likely to be refactored).

required
reg_size int

Number of bits in each target sub-register of target_reg.

required
register_permutation_function callable

Which quantum operation to use to effect the permutation of the target register.

required
ctrl Optional[Qubits, int]

Qreg to control on. Defaults to 0.

0
Note

target_reg is given as a single register or as a list of multiple registers.