-
Notifications
You must be signed in to change notification settings - Fork 982
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
Speed up single qubit gate layer generation for random quantum circuit #2764
Conversation
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.
LGTM, but format is unhappy.
The yapf on Travis is asking for something very strange, which is to have two consecutive newlines inside a function. My local yapf is not asking for that... |
I'm pretty reluctant to give in to the format check here. The change it's asking for doesn't make sense, and it conflicts with my local yapf, which is the same version as the one specified in |
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.
Very nice! My guess is that the formatter's issue has something to do with the long type annotations that require line breaks. Perhaps naming the union type so that the annotations are shorter could resolve the issue?
This method is much faster when the set of single qubit gates is large since it avoids generating a new list of gates to choose from. For instance, I was using a set of 64 gates and got around a 15x speedup.
I also modified the code to handle the case of when only one choice of single-qubit gate is given. In that case, the condition of no repeating single-qubit gates is simply not enforced.