-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Rename multiplexer_dg
with multiplexer_decomp_dg
after UC.inverse()
#8454
base: main
Are you sure you want to change the base?
Conversation
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the the following people are requested to review this:
|
9364fe5
to
133dd41
Compare
Isometry.inverse()
change in #8231multiplexer_dg
with multiplexer_decomp_dg
after UC.inverse()
c3a164a
to
8245151
Compare
Pull Request Test Coverage Report for Build 2815151750
💛 - Coveralls |
I'm not sure I remember the outcome of the last meeting correctly, but did we decide that it would be nicer if class UCGate(Gate):
def inverse(self):
definition = # compute inverse like right now
# inverted gate list
gate_list = list(reversed([np.conj(unitary.T) for unitary in self.params]))
# ensure inverting twice gives again "multiplexer"
name = "multiplexer_dg" if self.name == "multiplexer" else "multiplexer"
inv = UCGate(gate_list, up_to_diagonal=self.up_to_diagonal)
inv.name = name
inv.definition = definition
return inv |
Summary
#8231 produced regression in transpilation from inverse isometry to multiplexer.
Isometry.inverse()
generates amultiplexer
gate with basicGate
class. However, originally,multiplexer
is based onUCGate
that has parameters.This PR provides a work around by naming
multiplexer_decomp(_dg)
instead ofmultiplexer(_dg)
to generatedmultiplexer
gates ofGate
class.Details and comments
This bug exists before #8231.
UCGate.inverse().inverse()
returnsGate
instance that has not any parameters even though its name ismultiplexer
.Isometry.inverse()
internally callUCGate.inverse().inverse()
since #8231.Output:
If
multiplexer
must have parametergatelist
,UCGate.inverse()
should not namemultiplexer_dg
to a returnedGate
instance because it may producemultiplexer
gate with itsinverse()
.This PR names
multiplexer_decomp_dg
to a returnedGate
instance produced byUCGate.inverse()
.