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 circuit.unitary() using sparse matrices #1344

Merged
merged 3 commits into from
Jun 5, 2024

Conversation

andrea-pasquale
Copy link
Contributor

This PR proposes to speed up circuit.unitary() which returns the unitary corresponding to the circuit by performing the multiplication of all matrices gates using sparse matrices instead. I think that it makes sense given that most of times we are dealing with single and two qubit gates, which could be seen as sparse operators for large number of qubits.

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.82%. Comparing base (fc3a043) to head (9891ae2).

Additional details and impacted files
@@              Coverage Diff              @@
##           sgd_callback    #1344   +/-   ##
=============================================
  Coverage         99.82%   99.82%           
=============================================
  Files                72       72           
  Lines             10562    10572   +10     
=============================================
+ Hits              10543    10553   +10     
  Misses               19       19           
Flag Coverage Δ
unittests 99.82% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@andrea-pasquale andrea-pasquale mentioned this pull request Jun 5, 2024
4 tasks
Copy link
Contributor

@MatteoRobbiati MatteoRobbiati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @andrea-pasquale. It worked for me with 10q.

@MatteoRobbiati MatteoRobbiati merged commit c6d90ff into sgd_callback Jun 5, 2024
27 checks passed
@scarrazza scarrazza deleted the sparse_unitary branch June 25, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants