Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Fully port Split2QUnitaries to rust #13025
Fully port Split2QUnitaries to rust #13025
Changes from 3 commits
bee99b1
3d8af9d
911be95
e924c8a
7b0e363
2ff94f5
b2cdb54
913ec20
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Do we need a
to_vec
here or would it be faster to omit it here?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.
The
to_vec()
here is needed to get an owned object here.dag.get_qargs()
returns a slice that refers back to qubits owned bydag
's qubits list. If I didn't have this the compiler would complain that have I have an immutable reference todag
viaqubits
when I try to mutate the dag later inreplace_on_incoming_qubits
. I only added this because the compiler errored when I originally kept it as a slice. This is the same reason I had to collect the node indices into aVec
instead of directly iterating over the nodes.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.
Does
F
need to be mutable?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.
It does because I used
FnMut
for the the type here. It doesn't have to be mutable if we accepted anFn
forF
instead. I just wasn't sure which kind of callables we'd allow longer term and opted to be a bit more conservative in the typing, and havingFnMut
means the callable is allowed to mutate it's environment. I can change it toFn
in this case because the only callback we have so far doesn't need to beFnMut
.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 this case,
FnMut
is probably better as it allows the user more flexibility, it especially allows users to easily track the changes performed byreplace_on_incoming_qubits
.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.
Changed in: 2ff94f5