PermutationMatrix.gen_swap_unitary

static PermutationMatrix.gen_swap_unitary(radix=2)[source]

Generate a unitary matrix that swaps the state of two qudits.

Parameters:

radix (int) – The base of the qudits being swapped. Defaults to qubits or base 2. (Default: 2)

Raises:

ValueError – If radix is less than two.