-
Notifications
You must be signed in to change notification settings - Fork 92
Add a phased classical action for SelectedMajoranaFermion #1778
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
base: main
Are you sure you want to change the base?
Add a phased classical action for SelectedMajoranaFermion #1778
Conversation
Merge with upstream.
| if len(self.control_registers) > 1 or len(self.selection_registers) > 1: | ||
| return NotImplemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this restriction necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure - it is hard for me to understand what this gate does in the general case. Is my understanding in #1699 (comment) correct?
| if self.target_gate != cirq.X: | ||
| return NotImplemented |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In combination with basis_state_phase, this should be able to support Z as well. Z imparts a phase (and leaves the computational basis states unaffected)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have now added Z.
| max_selection = self.selection_registers[0].dtype.iteration_length_or_zero() - 1 | ||
| target = (2 ** (max_selection - selection)) ^ target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment describing how this logic works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Add a phased classical action for SelectedMajoranaFermion.
The classical action only exists for some choices of
target_gate, and we assume specificallytarget_gate=cirq.X(and also that there is only 1 control register and 1 selection register).Fixes #1699