Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PhaseAdder not correct #6230

Closed
1 task done
kevzos opened this issue Sep 6, 2024 · 5 comments
Closed
1 task done

[BUG] PhaseAdder not correct #6230

kevzos opened this issue Sep 6, 2024 · 5 comments
Labels
bug 🐛 Something isn't working

Comments

@kevzos
Copy link

kevzos commented Sep 6, 2024

Expected behavior

import pennylane as qml
x = 6
k = 7
mod = 4

x_wires =[0,1,2,3]
work_wire=[5]

dev = qml.device("default.qubit", shots=1)
@qml.qnode(dev)
def circuit():
qml.BasisEmbedding(x, wires=x_wires)
qml.QFT(wires=x_wires)
qml.PhaseAdder(k, x_wires, mod, work_wire)
qml.adjoint(qml.QFT)(wires=x_wires)
return qml.sample(wires=x_wires)
print(circuit())
#[0,0,0,1]

Actual behavior

#got [0 1 0 1]
#(6+7)mod 4 expect 1 ?

Additional information

No response

Source code

No response

Tracebacks

No response

System information

Name: PennyLane
Version: 0.38.0
Summary: PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
Home-page: https://github.com/PennyLaneAI/pennylane
Author: 
Author-email: 
License: Apache License 2.0
Location: /root/anaconda3/envs/py310/lib/python3.10/site-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: PennyLane_Lightning

Platform info:           Linux-3.10.0-1160.90.1.el7.x86_64-x86_64-with-glibc2.17
Python version:          3.10.0
Numpy version:           1.23.5
Scipy version:           1.10.0
Installed devices:
- default.clifford (PennyLane-0.38.0)
- default.gaussian (PennyLane-0.38.0)
- default.mixed (PennyLane-0.38.0)
- default.qubit (PennyLane-0.38.0)
- default.qubit.autograd (PennyLane-0.38.0)
- default.qubit.jax (PennyLane-0.38.0)
- default.qubit.legacy (PennyLane-0.38.0)
- default.qubit.tf (PennyLane-0.38.0)
- default.qubit.torch (PennyLane-0.38.0)
- default.qutrit (PennyLane-0.38.0)
- default.qutrit.mixed (PennyLane-0.38.0)
- default.tensor (PennyLane-0.38.0)
- null.qubit (PennyLane-0.38.0)
- lightning.qubit (PennyLane_Lightning-0.38.0)

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
@kevzos kevzos added the bug 🐛 Something isn't working label Sep 6, 2024
@KetpuntoG
Copy link
Contributor

Hi @kevzos , thanks for opening the report! :)
Note that in the documentation there is a note saying that to work the operator you must guarantee that x < mod. That must be the issue in this code

@justinpickering
Copy link
Contributor

That's correct @KetpuntoG - could we raise a warning when x > mod? cc @josh146 @isaacdevlugt

@KetpuntoG
Copy link
Contributor

KetpuntoG commented Sep 6, 2024

Unfortunately that is not possible, the template has not information about |x> @justinpickering

@justinpickering
Copy link
Contributor

Thanks for confirming, @KetpuntoG. We can close this ticket as no further action is required.
Thank you @kevzos for reporting this!

@justinpickering justinpickering closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2024
@kevzos
Copy link
Author

kevzos commented Sep 9, 2024

@justinpickering Thanks for your answers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants