Skip to content

lightning.qubit and null.qubit should track StatePrep in specs #8650

@isaacdevlugt

Description

@isaacdevlugt

Feature details

lightning.qubit and null.qubit handle StatePrep in a way that leads to confusing (potentially incorrect in the eyes of users) resource estimates/counts:

import pennylane as qml
import jax.numpy as jnp

qml.capture.enable()
qml.decomposition.enable_graph()

@qml.qjit
@qml.qnode(qml.device("lightning.qubit", wires=2))
def circuit():
    qml.StatePrep(
        jnp.array([1/jnp.sqrt(2), 1/jnp.sqrt(2)]), wires=1
    )
    qml.Hadamard(wires=0)
    return qml.state()

Running specs on this circuit shows the H gate only:

>>> print(qml.specs(circuit, level="device")()['resources'].gate_types)
defaultdict(<class 'int'>, {'Hadamard': 1})

Implementation

No response

How important would you say this feature is?

2: Somewhat important. Needed this quarter.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions