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
Adds various convenience functions to qiskit #12470
base: main
Are you sure you want to change the base?
Adds various convenience functions to qiskit #12470
Changes from 5 commits
6136968
7d8aafa
4ca1f7e
8fb7b7f
a8ac8fb
6495b26
ab35163
a204457
e85ca42
eda4a07
f17b201
e5a4f99
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.
why the function
depth_2q
is with>=2
andnum_2q_gates
is with==2
?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.
num_nq_gates
exactly checks the number of qubits because I thought users might be interested in that quantity in general. Also,num_nonlocal_gates
determines the number of gates with at least two qubits. I extended the arguments ofnum_nonlocal_gates
to include an integern
that specifies the minimum number of qubits in a gate to still be counted towards the quantity returned bynum_nonlocal_gates
. The default behavior ofnum_nonlocal_gates
stays the same, so I hope our stability policy is not violated...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.
Agree the name is a bit confusing an inconsistent with the others. Consider changing to something like
depth_multi_qubit
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 was also thinking about whether
depth_nq
should work on gates with exactlyn
qubits or for>= n
qubits. I decided for the latter because I thought the reason an user might wantdepth_nq
to exclude certain gates is that they are comparatively cheap. I think it is safe to assume that if an user regards a gate withn
qubits to be relatively expensive, they would also consider a gate withn+i
qubits to be expensive (if there are no other properties to decide on). I also was not able to see a situation where an user might only be interested in the two-qubit gate depth while ignoring all other gates in the presence of e.g. three-qubit gates.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 key phrase seems to be at least. And for this reason,
depth_nq
withn=2
is not the same thing asdepth_2q
. This is potentially confusing.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.
why the function
depth_nq
is with>=n
andnum_nq_gates
is with==n
?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.
Maybe have just this one with default
n = 2
and dropdepth_2q
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.
Same suggestion: have
n:int = 2
and drop thenum_2q_gates
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.
Thanks for your suggestion. I removed the
n=2
versions of the methods and updated the release notes accordingly!