Skip to content

Enable support for multiple graph-based decomposition with qp.decompose#2712

Closed
maliasadi wants to merge 9 commits intomainfrom
dgsolver_qp_decompose
Closed

Enable support for multiple graph-based decomposition with qp.decompose#2712
maliasadi wants to merge 9 commits intomainfrom
dgsolver_qp_decompose

Conversation

@maliasadi
Copy link
Copy Markdown
Member

@maliasadi maliasadi commented Apr 17, 2026

Context:
Follow up to #2552

A ptototype for fully integrate the graph-decomposition with qp.decompose enabling support for multiple decompose transformations and replace the old (decompose-lowering) logic from the frontend. This will be revisited when the graph-decomposition pass offers feature parity with qp.decompose

Example:

@qml.register_resources({qml.RX: 1})
def x_to_rx(wire: int):
    qml.RX(np.pi, wire)

@qml.register_resources({qml.RY: 1})
def y_to_ry(wire: int):
    qml.RY(np.pi, wire)

@qml.register_resources({qml.RX: 1, qml.RY: 1})
def h_to_rx_ry(wire: int):
    qml.RX(np.pi / 2, wire)
    qml.RY(np.pi / 2, wire)


@qml.qjit
@qml.decompose(gate_set={qml.Rot})
@qml.transforms.merge_rotations
@qml.decompose(
    gate_set={qml.RX, qml.RY},
    fixed_decomps={qml.PauliX: x_to_rx, qml.PauliY: y_to_ry},
    alt_decomps={qml.H: [h_to_rx_ry]},
)
@qml.transforms.cancel_inverses
@qml.qnode(qml.device("lightning.qubit", wires=2))
def circuit(x: float, y: float):
    qml.H(0)
    qml.H(0)
    qml.RX(x, wires=0)
    qml.PauliX(0)
    qml.RY(y, wires=0)
    qml.PauliY(0)
    qml.RY(x + y, wires=0)

    return qml.state()

Benefits:

  • Users can use qp.decompose instead of catalyst.graph_decomposition for multiple-decomposition applications

Possible Drawbacks:

Related GitHub Issues:
[sc-116956]

@maliasadi maliasadi closed this May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant