Skip to content
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

Merged
merged 14 commits into from
Feb 13, 2020

Conversation

kevinsung
Copy link
Collaborator

@kevinsung kevinsung commented Feb 12, 2020

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.

@googlebot googlebot added the cla: yes Makes googlebot stop complaining. label Feb 12, 2020
Copy link
Collaborator

@viathor viathor left a 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.

@kevinsung
Copy link
Collaborator Author

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...

@kevinsung
Copy link
Collaborator Author

kevinsung commented Feb 12, 2020

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 dev_tools/conf/pip-list-dev-tools.txt, which is version 0.27.0. Also, the change it's asking for is in a part of the file that I did not modify.

Copy link
Collaborator

@viathor viathor left a 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?

@kevinsung kevinsung merged commit c0a1b55 into quantumlib:master Feb 13, 2020
@kevinsung kevinsung deleted the xeb_circuit branch February 13, 2020 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants