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

Customize quantum_info functions #212

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

BrunoLiegiBastonLiegi
Copy link
Contributor

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi commented Feb 17, 2025

This provides customization for the quantum_info functions introduced in qiboteam/qibo#1583.
In the following some benchmarks run on 10 repetions:

pauli basis

### 3 qubits
--> numpy:  0.0009936720016412437
--> numba:  0.05624490500122192
--> cupy:  0.13221715999679873
### 5 qubits
--> numpy:  0.24638988500009873
--> numba:  0.06344797999918228
--> cupy:  0.005442648998723598
### 7 qubits
--> numpy:  82.37901496199993
--> numba:  15.51170543400076
--> cupy:  0.7553486539982259

random gaussian

##### random gaussian
### 5 qubits
--> numpy:  0.0017942120011866791
--> numba:  0.0047024770010466455
--> cupy:  0.13087414899928262
### 10 qubits
--> numpy:  0.35412388399890915
--> numba:  0.036867562999759684
--> cupy:  0.0028848960009781877
### 12 qubits
--> numpy:  6.0999391290006315
--> numba:  0.8496762070008117
--> cupy:  0.002546637000705232

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (193b569) to head (8113c44).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #212   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            7         7           
  Lines          604       615   +11     
=========================================
+ Hits           604       615   +11     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

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.

@BrunoLiegiBastonLiegi
Copy link
Contributor Author

This is ready for a first round of reviews. The notably missing elements are:

  • jitting the system ordered functions, this is not possible right now as numba does not support the construction of tuples with length not known at compile time, which is needed in the current implementation of vectorization/unvectorization_system. A workaround, may be possible but I did not spend too much time looking into that.
  • jitting random_unitary and the functions that depend on it was not possible due to the scipy.linalg.expm method not working with numba. We could implement the matrix exponential ourselves directly in native numpy, for istance through the padet method, but again did not spend too much time investigating that.
  • there are a bunch of minor warnings raised by numba concerning the use of parallel=True in functions where no parallelization was possible, and multiplication of fortran and c ordered arrays being suboptimal, which I could look into to get rid of.

@BrunoLiegiBastonLiegi BrunoLiegiBastonLiegi marked this pull request as ready for review March 5, 2025 08:19
@renatomello renatomello requested a review from stavros11 March 6, 2025 09:20
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.

1 participant