mqt.qudits.compiler.compilation_minitools

Common utilities for compilation.

Submodules

Package Contents

new_mod(a: float, b: float = 2 * np.pi) float[source]
phi_cost(theta: float) float[source]
pi_mod(a: float) float[source]
regulate_theta(angle: float) float[source]
rotation_cost_calc(gate: R, placement: LevelGraph) float[source]
swap_elements(list_nodes: list[T], i: int, j: int) list[T][source]
theta_cost(theta: float) float[source]
class UnitaryVerifier(sequence: Sequence[Gate | R | Rz | VirtRz], target: Gate, dimensions: list[int], nodes: list[int] | None = None, initial_map: list[int] | None = None, final_map: list[int] | None = None)[source]

Verifies unitary matrices.

sequence is a list of numpy arrays target is a numpy array dimensions is list of ints, equals to the dimensions of the qudits involved in the target operation initial_map is a list representing the mapping of the logic states to the physical ones at the beginning of the computation final_map is a list representing the mapping of the logic states to the physical ones at the end of the computation.

decomposition
target
dimension
permutation_matrix_initial: numpy.typing.NDArray[int_] | None = None
permutation_matrix_final: numpy.typing.NDArray[int_] | None = None
get_perm_matrix(nodes: list[int], mapping: list[int]) numpy.typing.NDArray[int_][source]
verify() bool[source]
apply_gate_to_tlines(gate_matrix: numpy.typing.NDArray[numpy.complex128], circuits_size: int = 2, targets: int | list[int] | None = None, dims: list[int] | None = None) numpy.typing.NDArray[numpy.complex128][source]
gate_expand_to_circuit(gate: numpy.typing.NDArray[numpy.complex128], circuits_size: int, target: int, dims: Sequence[int] | None = None) numpy.typing.NDArray[numpy.complex128][source]
on0(gate: numpy.typing.NDArray[numpy.complex128], other_size: int) numpy.typing.NDArray[numpy.complex128][source]
on1(gate: numpy.typing.NDArray[numpy.complex128], other_size: int) numpy.typing.NDArray[numpy.complex128][source]