mqt.core.plugins.catalyst

MQT Catalyst Plugin.

Submodules

Package Contents

configure_device_for_mqt(device: pennylane.devices.Device) pennylane.devices.Device[source]

Configure a PennyLane device to work optimally with the MQT plugin.

This function modifies device capabilities to prevent Catalyst from decomposing controlled gates (like qml.ctrl(PauliX)) into quantum.unitary operations with explicit matrix parameters. Instead, gates remain as quantum.custom operations that can be converted by the MQT plugin.

Parameters:

device – A PennyLane device instance to configure.

Returns:

The same device instance with modified capabilities.

Raises:

ValueError – If the device does not have a config_filepath attribute set.

Example

>>> import pennylane as qml
>>> from mqt.core.plugins.catalyst.device import configure_device_for_mqt
>>> dev = qml.device("lightning.qubit", wires=2)
>>> dev = configure_device_for_mqt(dev)
>>> @qml.qnode(dev)
... def circuit():
...     qml.ctrl(qml.PauliX(wires=0), control=1)  # Will become CNOT, not matrix
...     return qml.state()
get_device(device_name: str, **kwargs: Any) pennylane.devices.Device[source]

Create and configure a PennyLane device for use with the MQT plugin.

This is a convenience function that creates a device and automatically configures it to work optimally with the MQT plugin, preventing unnecessary decomposition to unitary matrices.

Parameters:
  • device_name – The name of the PennyLane device (e.g., “lightning.qubit”).

  • **kwargs – Additional keyword arguments passed to qml.device().

Returns:

A configured PennyLane device ready for use with MQT conversion passes.

Example

>>> from mqt.core.plugins.catalyst.device import get_device
>>> dev = get_device("lightning.qubit", wires=2)
>>> @qml.qnode(dev)
... def circuit():
...     qml.ctrl(qml.PauliX(wires=0), control=1)
...     return qml.state()
get_catalyst_plugin_abs_path() Path[source]

Locate the mqt-catalyst-plugin shared library.

Returns:

The absolute path to the plugin shared library.

Raises:

FileNotFoundError – If the plugin library is not found.

name2pass(name: str) tuple[Path, str][source]

Convert a pass name to its plugin path and pass name (required by Catalyst).

Parameters:

name – The name of the pass, e.g., “mqt-core-round-trip”.

Returns:

A tuple containing the absolute path to the plugin and the pass name.