Skip to content

Update dump_machine and dump_operation based on feedback#1227

Merged
swernli merged 4 commits into
mainfrom
swernli/python-dump-machine
Mar 14, 2024
Merged

Update dump_machine and dump_operation based on feedback#1227
swernli merged 4 commits into
mainfrom
swernli/python-dump-machine

Conversation

@swernli
Copy link
Copy Markdown
Collaborator

@swernli swernli commented Mar 4, 2024

This updates the Python functions for dumping state vectors and operation matrices to both use complex numbers, provide
better compatibility with input, and allow for common iteration patterns.

Fixes #1178
Fixes #1177
Fixes #1223

This updates the Python functions for dumping state vectors and operation matrices to both use complex numbers, provide
better compatibility with input, and allow for common iteration patterns.

Fixes #1178
Fixes #1177
Fixes #1223
@swernli swernli marked this pull request as ready for review March 4, 2024 23:05
@swernli swernli requested a review from tcNickolas March 4, 2024 23:06
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 4, 2024

Benchmark for 4bade57

Click to view benchmark
Test Base PR %
Array append evaluation 757.9±13.97µs 754.5±5.91µs -0.45%
Array literal evaluation 539.3±29.18µs 531.5±8.68µs -1.45%
Array update evaluation 755.2±8.56µs 754.9±3.53µs -0.04%
Deutsch-Jozsa evaluation 7.2±0.16ms 7.1±0.08ms -1.39%
Large file parity evaluation 35.4±1.24ms 35.3±0.08ms -0.28%
Large input file 40.3±0.83ms 40.9±1.14ms +1.49%
Large nested iteration 74.5±0.45ms 76.8±0.47ms +3.09%
Standard library 23.1±0.86ms 23.6±0.57ms +2.16%
Teleport evaluation 97.5±1.65µs 97.7±6.98µs +0.21%

Copy link
Copy Markdown
Contributor

@tcNickolas tcNickolas left a comment

Choose a reason for hiding this comment

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

Looking at the tests, the changes look good, but might need more tests to cover the scenarios that are being fixed

Comment thread pip/tests/test_qsharp.py
Comment thread pip/tests/test_qsharp.py
Comment thread pip/tests/test_qsharp.py Outdated

Check notice

Code scanning / devskim

If untrusted data (data from HTTP requests, user submitted files, etc.) is included in an eval statement it can allow an attacker to inject their own code.

Review eval for untrusted data
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2024

Benchmark for 4cd65e9

Click to view benchmark
Test Base PR %
Array append evaluation 754.2±9.26µs 759.8±33.97µs +0.74%
Array literal evaluation 529.3±15.31µs 522.3±21.71µs -1.32%
Array update evaluation 755.0±12.38µs 754.5±5.28µs -0.07%
Deutsch-Jozsa evaluation 7.1±0.08ms 7.1±0.09ms 0.00%
Large file parity evaluation 35.5±1.12ms 35.3±0.20ms -0.56%
Large input file 42.0±0.94ms 41.2±0.99ms -1.90%
Large nested iteration 75.6±2.03ms 76.9±2.14ms +1.72%
Standard library 23.6±0.72ms 23.0±0.53ms -2.54%
Teleport evaluation 96.6±2.07µs 96.1±1.68µs -0.52%

Comment thread pip/qsharp/_native.pyi
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2024

Benchmark for bcc9cde

Click to view benchmark
Test Base PR %
Array append evaluation 757.7±8.30µs 755.7±7.33µs -0.26%
Array literal evaluation 509.5±32.59µs 508.0±29.88µs -0.29%
Array update evaluation 749.6±5.44µs 751.1±3.83µs +0.20%
Deutsch-Jozsa evaluation 7.0±0.05ms 7.1±0.06ms +1.43%
Large file parity evaluation 35.1±0.46ms 35.2±0.73ms +0.28%
Large input file 42.1±0.97ms 41.1±1.04ms -2.38%
Large nested iteration 74.4±0.50ms 74.7±1.34ms +0.40%
Standard library 23.6±0.61ms 23.3±0.81ms -1.27%
Teleport evaluation 95.7±1.61µs 96.8±3.36µs +1.15%

Comment thread pip/qsharp/_qsharp.py
Comment thread pip/qsharp/__init__.py Outdated
@swernli swernli enabled auto-merge March 14, 2024 20:16
@github-actions
Copy link
Copy Markdown

Benchmark for 5441bdc

Click to view benchmark
Test Base PR %
Array append evaluation 757.0±17.17µs 754.9±5.63µs -0.28%
Array literal evaluation 509.2±30.80µs 507.3±28.94µs -0.37%
Array update evaluation 753.1±6.85µs 751.7±3.62µs -0.19%
Deutsch-Jozsa evaluation 7.0±0.05ms 7.0±0.07ms 0.00%
Large file parity evaluation 35.1±0.17ms 35.3±1.13ms +0.57%
Large input file 40.1±1.46ms 42.8±0.97ms +6.73%
Large nested iteration 74.3±0.40ms 74.8±0.63ms +0.67%
Standard library 23.1±0.48ms 24.0±0.72ms +3.90%
Teleport evaluation 95.5±2.95µs 95.7±1.88µs +0.21%

@swernli swernli added this pull request to the merge queue Mar 14, 2024
Merged via the queue into main with commit 9c4a706 Mar 14, 2024
@swernli swernli deleted the swernli/python-dump-machine branch March 14, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

5 participants