Skip to content

Conversation

@rniczh
Copy link
Contributor

@rniczh rniczh commented Jan 7, 2026

Context:

from catalyst import *
import pennylane as qml

qml.capture.enable()

@qjit
@qml.qnode(qml.device("lightning.qubit", wires=3, shots=10))
def circuit():
    with qml.allocate(2) as qs:
        qml.X(qs[1])

    return qml.sample(wires=[0, 1])

print(circuit())

It get unexpected result due to the aux wires involved.

[[0 0]
 [0 1]
 [0 0]
 [1 0]
 [0 0]
 [0 0]
 [0 1]
 [0 0]
 [1 0]
 [0 0]]

Description of the Change:

Add an error message for these case

Benefits:

Possible Drawbacks:

Related GitHub Issues:

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@paul0403
Copy link
Member

paul0403 commented Jan 8, 2026

@rniczh can you update the sharp bits documentation regarding dynamic allocation as well? doc/dex/sharp_bits.rst, the section near the end regarding differences between PL and catalyst

@dime10
Copy link
Contributor

dime10 commented Jan 8, 2026

@rniczh can you update the sharp bits documentation regarding dynamic allocation as well? doc/dex/sharp_bits.rst, the section near the end regarding differences between PL and catalyst

I guess we might not need this anymore if the proper fix is nearing completion?

@paul0403
Copy link
Member

paul0403 commented Jan 8, 2026

@rniczh can you update the sharp bits documentation regarding dynamic allocation as well? doc/dex/sharp_bits.rst, the section near the end regarding differences between PL and catalyst

I guess we might not need this anymore if the proper fix is nearing completion?

Wow it is?? That was so fast! (Sorry I haven't been following up)

@rniczh
Copy link
Contributor Author

rniczh commented Jan 9, 2026

@paul0403 So hopefully if the review of PennyLaneAI/pennylane-lightning#1321 is all good, we can close this PR, otherwise this PR would still be an alternative choice.

@isaacdevlugt
Copy link
Contributor

will add a changelog entry for this in the changelog PR

@paul0403 paul0403 modified the milestone: v0.14.0 Jan 9, 2026
@rniczh rniczh merged commit 570480c into v0.14.0-rc Jan 9, 2026
38 checks passed
@rniczh rniczh deleted the rniczh/raise-error-message-for-dynamic-wires-with-non-prob branch January 9, 2026 20:57
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.

5 participants