mqt.qudits.quantum_circuit.gate

Module Contents

Parameter
class Instruction(name: str)[source]

Bases: abc.ABC

Helper class that provides a standard way to create an ABC using inheritance.

class Gate(circuit: QuantumCircuit, name: str, gate_type: GateTypes, target_qudits: list[int] | int, dimensions: list[int] | int, params: Parameter = None, control_set: ControlData | None = None, label: str | None = None, lev_a: int = 0, lev_b: int = 0, theta: float = 0.0, phi: float = 0.0, qasm_tag: str = '')[source]

Bases: Instruction

Unitary gate_matrix.

dagger = False
parent_circuit
gate_type
is_long_range
lev_a: int = 0
lev_b: int = 0
theta: float = 0.0
phi: float = 0.0
qasm_tag = ''
property reference_lines: list[int]
abstractmethod __array__() numpy.typing.NDArray[numpy.complex128][source]
dag() Gate[source]
to_matrix(identities: int = 0) numpy.typing.NDArray[numpy.complex128][source]

Return a np.ndarray for the gate_matrix unitary parameters.

Returns:

if the Gate subclass has a parameters definition.

Return type:

np.ndarray

Raises:

CircuitError – If a Gate subclass does not implement this method an exception will be raised when this base class method is called.

control(indices: list[int], ctrl_states: list[int]) Gate[source]
validate_parameter(parameter: Parameter) bool[source]
property dimensions: list[int] | int
property target_qudits: list[int] | int

Get the target qudits.

Returns:

The current target qudits.

Return type:

Union[List[int], np.ndarray]

__qasm__() str[source]

Generate QASM for Gate export.

check_long_range() bool[source]
set_gate_type_single() None[source]
set_gate_type_two() None[source]
set_gate_type_multi() None[source]
property get_control_lines: list[int]
property control_info: dict[str, int | list[int] | Parameter | ControlData]
return_custom_data() str[source]