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

Add support for ControlledQubitUnitary #50

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

Hosseinberg
Copy link

resolves issue #49. Tests need to be added though.

@Hosseinberg Hosseinberg changed the title (draft) Add support for ControlledQubitUnitary Add support for ControlledQubitUnitary Apr 26, 2023
@Hosseinberg
Copy link
Author

added a test

@leofang
Copy link

leofang commented Jul 10, 2023

Friendly nudge @isaacdevlugt 🙂

Copy link

@frederikwilde frederikwilde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this contribution, @Hosseinberg! And sorry for the delay. I think this is mostly good to merge. There are just a couple minor changes I suggested.

And if my understanding of the test is correct, I think we should add a test case for a non-trivial control-register state. Let me know what you think.

tests/test_apply.py Outdated Show resolved Hide resolved
pennylane_qulacs/qulacs_device.py Outdated Show resolved Hide resolved
pennylane_qulacs/qulacs_device.py Show resolved Hide resolved
pennylane_qulacs/qulacs_device.py Outdated Show resolved Hide resolved
pennylane_qulacs/qulacs_device.py Outdated Show resolved Hide resolved

op = qml.ControlledQubitUnitary(mat, wires=list(range(len(control_wires), N+len(control_wires))),
control_wires=control_wires)
dev.apply([qml.QubitStateVector(state, wires=list(range(N + len(control_wires)))), op])

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this correctly, but does this leave the control wires in the |0> state? This would make the control operation trivial, no? Maybe it would be good to test this for the |+> state in the control register. What do you think?

@frederikwilde
Copy link

I'm not sure I understand this correctly, but does this leave the control wires in the |0> state? This would make the control operation trivial, no? Maybe it would be good to test this for the |+> state in the control register. What do you think?

Hi @Hosseinberg, I just wanted to check in and hear what you think about this comment? I think if we have a test like this we can merge the PR.

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.

3 participants