Skip to content

Add support for qml.map_wires #1800

Open
@paul0403

Description

@paul0403

Catalyst and PennyLane has always interpreted wire labels differently.

For example, when a new label

    qml.gate_or_measurement(wires=1000)

is encountered, core pennylane considers "1000" as a pure wire label, and interprets that as one new wire, with the label "1000".

However in catalyst we do not associate wires with arbitrary labels and require wires to be continuous integers from zero, and we would interpret this as "allocate new wires until we have 1001 wires, and act on wire[1000]".

There is a qml.map_wires transform that essentially allow users to map wire indices from one set of labels to another set of labels. This can be used as a workaround for users to still use arbitrary labels in the circuit itself, but have the "arbitrary label to [0,1,2,...]" map tell catalyst what to do.

However, this transform does not currently work with catalyst.

Although we indicated that this is one of the PL transforms without a catalyst pass counterpart (https://github.com/PennyLaneAI/catalyst/blob/main/frontend/catalyst/from_plxpr.py#L205), other implementations are certainly welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions