Skip to content

workbench_algorithms.subroutines.permutations._default_permutation_functions

Functions for permuting qubit registers.

get_default_register_permutation_function

get_default_register_permutation_function(index_reg=0)

Factory to generate the default register permutation function.

This function acts as a factory to return a callable that permutes two qubit registers according to the index passed into the returned callable, which indicates which iteration of the total permutation we are currently on.

All register permutation functions must adhere to the contract of having a signature of permutation_index (int), reg1 (Qubits), reg2 (Qubits), and ctrl (Qubits or int), such that the permutation Qubricks that call them are promised a certain signature.

Parameters:

Name Type Description Default
index_reg (Optional, Qubits)

An index register which coherently controls the application of quantum operations that effect a permutation of two qubit registers. Defaults to 0, in which case a permutation will occur regardless.

0

Returns:

Type Description
Callable

callable register permutation function.

get_reversed_binary_to_unary_permutation_function

get_reversed_binary_to_unary_permutation_function(
    index_reg=0,
)

Factory to generate permutation circuits which undo a binary-to-unary conversion.

This function acts as a factory to return a callable that permutes two qubit registers according to the index passed into the returned callable, which indicates which iteration of the total permutation we are currently on.

All register permutation functions must adhere to the contract of having a signature of permutation_index (int), reg1 (Qubits), reg2 (Qubits), and ctrl (Qubits or int), such that the permutation Qubricks that call them are promised a certain signature.

Parameters:

Name Type Description Default
index_reg (Optional, Qubits)

An index register which coherently controls the application of quantum operations that effect a permutation of two qubit registers. Defaults to 0, in which case a permutation will occur regardless.

0

Returns:

Type Description
Callable

callable register permutation function.