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] qml.TShift power method is incorrect #6355

Open
1 task done
willjmax opened this issue Oct 7, 2024 · 0 comments
Open
1 task done

[BUG] qml.TShift power method is incorrect #6355

willjmax opened this issue Oct 7, 2024 · 0 comments
Labels
bug 🐛 Something isn't working

Comments

@willjmax
Copy link
Contributor

willjmax commented Oct 7, 2024

Expected behavior

Raising a TShift operator to the power of 2 should return something.

Actual behavior

The current implementation of pow on the TShift operator is given by

    def pow(self, z):
        return super().pow(z % 3)

which calls the pow method on the Operator class, given by

        if z == 0:
            return []
        if z == 1:
            if QueuingManager.recording():
                return [qml.apply(self)]
            return [copy.copy(self)]
        raise PowUndefinedError

So, attempting to raise a TShift to the power of 2 results in a PowUndefinedError.

Additional information

No response

Source code

No response

Tracebacks

No response

System information

Name: PennyLane
Version: 0.39.0.dev25
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: /home/william.maxwell/venvs/pl-py3.10/lib/python3.10/site-packages
Editable project location: /home/william.maxwell/pennylane/pennylane
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, packaging, pennylane-lightning, requests, rustworkx, scipy, toml, typing-extensions
Required-by: amazon-braket-pennylane-plugin, PennyLane-Catalyst, PennyLane_Lightning, PennyLane_Lightning_Kokkos

Platform info:           Linux-6.8.0-45-generic-x86_64-with-glibc2.35
Python version:          3.10.12
Numpy version:           1.26.4
Scipy version:           1.12.0
Installed devices:
- lightning.qubit (PennyLane_Lightning-0.39.0.dev24)
- default.clifford (PennyLane-0.39.0.dev25)
- default.gaussian (PennyLane-0.39.0.dev25)
- default.mixed (PennyLane-0.39.0.dev25)
- default.qubit (PennyLane-0.39.0.dev25)
- default.qutrit (PennyLane-0.39.0.dev25)
- default.qutrit.mixed (PennyLane-0.39.0.dev25)
- default.tensor (PennyLane-0.39.0.dev25)
- null.qubit (PennyLane-0.39.0.dev25)
- reference.qubit (PennyLane-0.39.0.dev25)
- lightning.kokkos (PennyLane_Lightning_Kokkos-0.39.0.dev24)
- nvidia.custatevec (PennyLane-Catalyst-0.9.0.dev12)
- nvidia.cutensornet (PennyLane-Catalyst-0.9.0.dev12)
- oqc.cloud (PennyLane-Catalyst-0.9.0.dev12)
- softwareq.qpp (PennyLane-Catalyst-0.9.0.dev12)
- braket.aws.ahs (amazon-braket-pennylane-plugin-1.30.1)
- braket.aws.qubit (amazon-braket-pennylane-plugin-1.30.1)
- braket.local.ahs (amazon-braket-pennylane-plugin-1.30.1)
- braket.local.qubit (amazon-braket-pennylane-plugin-1.30.1)

Existing GitHub issues

  • I have searched existing GitHub issues to make sure the issue does not already exist.
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

1 participant