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

Add dump_operation to Python API #1055

Merged
merged 8 commits into from
Jan 23, 2024
Merged

Add dump_operation to Python API #1055

merged 8 commits into from
Jan 23, 2024

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented Jan 20, 2024

This adds a new dump_operation to Python that when given an operation expression to test and a number of qubits will execute that operation in isolation and produce an output matrix (array of arrays) of complex numbers representing the operation.

Fixes #1009

This adds a new `dump_operation` to Python that when given an operation expression to test and a number of qubits will execute that operation in isolation and produce an output matrix (array of arrays) of complex numbers representing the operation.

Fixes #1009
pip/tests/test_qsharp.py Fixed Show fixed Hide fixed
Copy link

Benchmark for a5222a4

Click to view benchmark
Test Base PR %
Array append evaluation 867.2±13.42µs 881.6±7.26µs +1.66%
Array update evaluation 942.8±6.20µs 956.9±5.45µs +1.50%
Deutsch-Jozsa evaluation 31.5±0.72ms 31.5±0.24ms 0.00%
Large file parity evaluation 36.2±1.18ms 36.2±0.31ms 0.00%
Large input file 38.6±0.74ms 39.6±1.01ms +2.59%
Standard library 20.8±0.23ms 20.9±0.38ms +0.48%
Teleport evaluation 104.3±1.63µs 105.3±3.15µs +0.96%

@swernli swernli requested a review from tcNickolas January 20, 2024 15:33
Copy link

Benchmark for 3c1172c

Click to view benchmark
Test Base PR %
Array append evaluation 862.0±8.16µs 860.2±5.99µs -0.21%
Array update evaluation 933.4±9.29µs 932.5±7.76µs -0.10%
Deutsch-Jozsa evaluation 31.4±0.19ms 31.3±0.21ms -0.32%
Large file parity evaluation 35.9±0.05ms 36.0±0.19ms +0.28%
Large input file 38.2±0.73ms 38.1±0.71ms -0.26%
Standard library 20.9±0.23ms 20.8±0.31ms -0.48%
Teleport evaluation 103.8±2.02µs 104.0±2.80µs +0.19%

pip/qsharp/_native.pyi Outdated Show resolved Hide resolved
pip/src/interpreter.rs Outdated Show resolved Hide resolved
Co-authored-by: Mine Starks <16928427+minestarks@users.noreply.github.com>
Copy link

Benchmark for 63f09d7

Click to view benchmark
Test Base PR %
Array append evaluation 877.9±8.72µs 876.7±9.62µs -0.14%
Array update evaluation 956.3±5.55µs 953.1±8.57µs -0.33%
Deutsch-Jozsa evaluation 31.3±0.32ms 31.3±0.21ms 0.00%
Large file parity evaluation 36.6±0.20ms 36.9±0.35ms +0.82%
Large input file 37.7±0.71ms 37.8±0.96ms +0.27%
Standard library 20.9±0.18ms 20.9±0.30ms 0.00%
Teleport evaluation 104.7±1.70µs 104.8±5.30µs +0.10%

@swernli swernli requested a review from cesarzc as a code owner January 22, 2024 20:05
Copy link

Benchmark for 776e325

Click to view benchmark
Test Base PR %
Array append evaluation 879.5±13.89µs 858.7±7.47µs -2.36%
Array update evaluation 956.9±19.12µs 937.6±15.86µs -2.02%
Deutsch-Jozsa evaluation 31.5±0.17ms 31.2±0.17ms -0.95%
Large file parity evaluation 36.1±0.06ms 36.0±0.33ms -0.28%
Large input file 38.8±0.73ms 39.2±1.42ms +1.03%
Standard library 21.1±0.35ms 22.0±0.99ms +4.27%
Teleport evaluation 106.6±1.84µs 103.1±7.65µs -3.28%

minestarks
minestarks previously approved these changes Jan 23, 2024
Copy link
Member

@minestarks minestarks left a comment

Choose a reason for hiding this comment

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

Looks very nice!

@swernli swernli marked this pull request as draft January 23, 2024 18:55
@swernli swernli marked this pull request as ready for review January 23, 2024 19:41
@swernli swernli dismissed minestarks’s stale review January 23, 2024 19:42

need re-review

Copy link

Benchmark for 45eabc8

Click to view benchmark
Test Base PR %
Array append evaluation 874.3±12.88µs 860.3±4.28µs -1.60%
Array update evaluation 949.3±3.69µs 933.4±4.01µs -1.67%
Deutsch-Jozsa evaluation 31.4±0.18ms 31.4±0.55ms 0.00%
Large file parity evaluation 36.0±0.12ms 35.9±0.09ms -0.28%
Large input file 39.4±0.94ms 38.4±0.74ms -2.54%
Standard library 21.0±0.33ms 21.1±0.46ms +0.48%
Teleport evaluation 104.5±1.97µs 103.7±2.24µs -0.77%

Copy link
Member

@minestarks minestarks left a comment

Choose a reason for hiding this comment

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

Even nicer! Let's discuss separately whether we want to take it into the qsharp module and/or a submodule.

pip/tests/test_qsharp.py Dismissed Show dismissed Hide dismissed
pip/qsharp/_qsharp.py Outdated Show resolved Hide resolved
Copy link

Benchmark for ae1918c

Click to view benchmark
Test Base PR %
Array append evaluation 882.2±5.79µs 870.9±7.51µs -1.28%
Array update evaluation 959.1±6.42µs 941.8±8.82µs -1.80%
Deutsch-Jozsa evaluation 31.4±0.23ms 31.3±0.19ms -0.32%
Large file parity evaluation 36.0±0.20ms 35.9±0.28ms -0.28%
Large input file 37.6±0.62ms 38.0±0.69ms +1.06%
Standard library 20.9±0.22ms 20.9±0.25ms 0.00%
Teleport evaluation 104.5±1.95µs 103.1±2.14µs -1.34%

@swernli swernli enabled auto-merge January 23, 2024 21:12
@swernli swernli added this pull request to the merge queue Jan 23, 2024
Merged via the queue into main with commit 80b1999 Jan 23, 2024
14 checks passed
@swernli swernli deleted the swernli/issue1009 branch January 23, 2024 21:57
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.

Add dump_operation to Python API
2 participants