qevedo-simulator 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. qevedo_simulator-0.1.0/.cargo/config.toml +2 -0
  2. qevedo_simulator-0.1.0/.deepsource.toml +15 -0
  3. qevedo_simulator-0.1.0/.github/workflows/ci.yml +45 -0
  4. qevedo_simulator-0.1.0/.github/workflows/release.yml +112 -0
  5. qevedo_simulator-0.1.0/.gitignore +8 -0
  6. qevedo_simulator-0.1.0/Cargo.lock +1199 -0
  7. qevedo_simulator-0.1.0/Cargo.toml +32 -0
  8. qevedo_simulator-0.1.0/LICENSE +21 -0
  9. qevedo_simulator-0.1.0/PKG-INFO +69 -0
  10. qevedo_simulator-0.1.0/README.md +355 -0
  11. qevedo_simulator-0.1.0/benchmarks/README.md +130 -0
  12. qevedo_simulator-0.1.0/benchmarks/charts/mps.svg +2038 -0
  13. qevedo_simulator-0.1.0/benchmarks/charts/nearclifford.svg +2338 -0
  14. qevedo_simulator-0.1.0/benchmarks/charts/stabilizer.svg +1652 -0
  15. qevedo_simulator-0.1.0/benchmarks/charts/stabilizer_steps.svg +2014 -0
  16. qevedo_simulator-0.1.0/benchmarks/charts/statevector.svg +2055 -0
  17. qevedo_simulator-0.1.0/benchmarks/compare.py +88 -0
  18. qevedo_simulator-0.1.0/benchmarks/compare_mps.py +84 -0
  19. qevedo_simulator-0.1.0/benchmarks/compare_nearclifford.py +41 -0
  20. qevedo_simulator-0.1.0/benchmarks/compare_stim.py +75 -0
  21. qevedo_simulator-0.1.0/benchmarks/plot.py +247 -0
  22. qevedo_simulator-0.1.0/benchmarks/results/machine.json +22 -0
  23. qevedo_simulator-0.1.0/benchmarks/results/mps.csv +19 -0
  24. qevedo_simulator-0.1.0/benchmarks/results/nearclifford.csv +20 -0
  25. qevedo_simulator-0.1.0/benchmarks/results/stabilizer.csv +19 -0
  26. qevedo_simulator-0.1.0/benchmarks/results/stabilizer_steps.csv +9 -0
  27. qevedo_simulator-0.1.0/benchmarks/results/statevector.csv +25 -0
  28. qevedo_simulator-0.1.0/docs/DESIGN.md +533 -0
  29. qevedo_simulator-0.1.0/examples/bandwidth.rs +86 -0
  30. qevedo_simulator-0.1.0/examples/bench.rs +83 -0
  31. qevedo_simulator-0.1.0/examples/kernels.rs +114 -0
  32. qevedo_simulator-0.1.0/examples/l2.rs +44 -0
  33. qevedo_simulator-0.1.0/examples/mps.rs +91 -0
  34. qevedo_simulator-0.1.0/examples/nearclifford.rs +61 -0
  35. qevedo_simulator-0.1.0/examples/quickstart.rs +18 -0
  36. qevedo_simulator-0.1.0/examples/shots.rs +26 -0
  37. qevedo_simulator-0.1.0/examples/stabilizer.rs +59 -0
  38. qevedo_simulator-0.1.0/pyproject.toml +34 -0
  39. qevedo_simulator-0.1.0/python/Cargo.lock +1278 -0
  40. qevedo_simulator-0.1.0/python/Cargo.toml +23 -0
  41. qevedo_simulator-0.1.0/python/README.md +49 -0
  42. qevedo_simulator-0.1.0/python/qevedo/simulator/__init__.py +136 -0
  43. qevedo_simulator-0.1.0/python/src/lib.rs +515 -0
  44. qevedo_simulator-0.1.0/python/tests/test_simulator.py +184 -0
  45. qevedo_simulator-0.1.0/reports/Fastest quantum circuit simulator design.md +185 -0
  46. qevedo_simulator-0.1.0/research_notes/Fastest quantum circuit simulator design/beyond_ram_and_records.md +336 -0
  47. qevedo_simulator-0.1.0/research_notes/Fastest quantum circuit simulator design/fusion_and_cache_blocking.md +215 -0
  48. qevedo_simulator-0.1.0/research_notes/Fastest quantum circuit simulator design/rust_implementation.md +349 -0
  49. qevedo_simulator-0.1.0/research_notes/Fastest quantum circuit simulator design/state_vector_kernels.md +240 -0
  50. qevedo_simulator-0.1.0/research_notes/Fastest quantum circuit simulator design/structure_exploiting_methods.md +252 -0
  51. qevedo_simulator-0.1.0/src/blocking.rs +302 -0
  52. qevedo_simulator-0.1.0/src/circuit.rs +467 -0
  53. qevedo_simulator-0.1.0/src/fusion.rs +216 -0
  54. qevedo_simulator-0.1.0/src/kernels.rs +547 -0
  55. qevedo_simulator-0.1.0/src/lib.rs +29 -0
  56. qevedo_simulator-0.1.0/src/library.rs +276 -0
  57. qevedo_simulator-0.1.0/src/matrix.rs +235 -0
  58. qevedo_simulator-0.1.0/src/measure.rs +175 -0
  59. qevedo_simulator-0.1.0/src/memory.rs +181 -0
  60. qevedo_simulator-0.1.0/src/mps/layout.rs +184 -0
  61. qevedo_simulator-0.1.0/src/mps/mod.rs +196 -0
  62. qevedo_simulator-0.1.0/src/mps/state.rs +1332 -0
  63. qevedo_simulator-0.1.0/src/nearclifford/dense.rs +283 -0
  64. qevedo_simulator-0.1.0/src/nearclifford/mod.rs +1074 -0
  65. qevedo_simulator-0.1.0/src/qasm.rs +1252 -0
  66. qevedo_simulator-0.1.0/src/reference.rs +44 -0
  67. qevedo_simulator-0.1.0/src/simd.rs +344 -0
  68. qevedo_simulator-0.1.0/src/simulator.rs +402 -0
  69. qevedo_simulator-0.1.0/src/stabilizer/mod.rs +521 -0
  70. qevedo_simulator-0.1.0/src/stabilizer/tableau.rs +1345 -0
  71. qevedo_simulator-0.1.0/src/state.rs +269 -0
  72. qevedo_simulator-0.1.0/src/threads.rs +160 -0
  73. qevedo_simulator-0.1.0/tests/common/mod.rs +149 -0
  74. qevedo_simulator-0.1.0/tests/kernels.rs +92 -0
  75. qevedo_simulator-0.1.0/tests/mps.rs +271 -0
  76. qevedo_simulator-0.1.0/tests/nearclifford.rs +297 -0
  77. qevedo_simulator-0.1.0/tests/qasm.rs +346 -0
  78. qevedo_simulator-0.1.0/tests/simulator.rs +214 -0
  79. qevedo_simulator-0.1.0/tests/stabilizer.rs +341 -0
@@ -0,0 +1,2 @@
1
+ [build]
2
+ rustflags = ["-C", "target-cpu=native"]
@@ -0,0 +1,15 @@
1
+ version = 1
2
+
3
+ [[analyzers]]
4
+ name = "rust"
5
+ enabled = true
6
+
7
+ [analyzers.meta]
8
+ msrv = "1.87.0"
9
+
10
+ [[analyzers]]
11
+ name = "python"
12
+ enabled = true
13
+
14
+ [analyzers.meta]
15
+ runtime_version = "3.x.x"
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_call:
7
+
8
+ jobs:
9
+ rust:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v5
13
+ - uses: dtolnay/rust-toolchain@stable
14
+ with:
15
+ components: rustfmt, clippy
16
+ - name: Format
17
+ run: cargo fmt --check
18
+ - name: Clippy
19
+ run: cargo clippy --release --all-targets -- -D warnings
20
+ - name: Test
21
+ run: cargo test --release
22
+
23
+ python:
24
+ strategy:
25
+ fail-fast: false
26
+ matrix:
27
+ os: [ubuntu-latest, macos-latest, windows-latest]
28
+ runs-on: ${{ matrix.os }}
29
+ defaults:
30
+ run:
31
+ working-directory: python
32
+ shell: bash
33
+ steps:
34
+ - uses: actions/checkout@v5
35
+ - uses: dtolnay/rust-toolchain@stable
36
+ - uses: actions/setup-python@v6
37
+ with:
38
+ python-version: "3.12"
39
+ - name: Build and install
40
+ run: |
41
+ python -m pip install "maturin==1.15.0"
42
+ maturin build --release --out dist
43
+ python -m pip install --find-links dist "qevedo-simulator[test]"
44
+ - name: Test
45
+ run: python -m pytest
@@ -0,0 +1,112 @@
1
+ name: Release
2
+
3
+ # Publish qevedo-simulator to PyPI when a version tag (vX.Y.Z) is pushed. The
4
+ # tag must match the version in python/Cargo.toml and CI must pass.
5
+ #
6
+ # Publishing uses PyPI trusted publishing: on pypi.org, add a (pending)
7
+ # trusted publisher for project "qevedo-simulator", owner "qevedo",
8
+ # repository "qevedo-simulator", workflow "release.yml", environment "pypi".
9
+ #
10
+ # x86-64 wheels target x86-64-v3 (AVX2 + FMA, 2013-2015 processors and newer)
11
+ # for qvd's AVX2 kernels; the repository's own `-C target-cpu=native` must not
12
+ # leak into wheels, so every build sets RUSTFLAGS.
13
+ on:
14
+ push:
15
+ tags: ["v[0-9]+.[0-9]+.[0-9]+*"]
16
+
17
+ jobs:
18
+ ci:
19
+ uses: ./.github/workflows/ci.yml
20
+
21
+ check:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - uses: actions/checkout@v5
25
+ - name: Check the tag against the version
26
+ run: |
27
+ version=$(sed -n 's/^version = "\(.*\)"/\1/p' python/Cargo.toml | head -1)
28
+ if [ "v$version" != "$GITHUB_REF_NAME" ]; then
29
+ echo "::error::tag $GITHUB_REF_NAME does not match python/Cargo.toml version $version"
30
+ exit 1
31
+ fi
32
+
33
+ wheels:
34
+ needs: [ci, check]
35
+ strategy:
36
+ fail-fast: false
37
+ matrix:
38
+ include:
39
+ - { os: ubuntu-latest, target: x86_64, rustflags: "-C target-cpu=x86-64-v3" }
40
+ - { os: ubuntu-latest, target: aarch64, rustflags: "-C target-cpu=generic" }
41
+ - { os: macos-latest, target: aarch64, rustflags: "-C target-cpu=apple-m1" }
42
+ - { os: macos-latest, target: x86_64, rustflags: "-C target-cpu=x86-64-v3" }
43
+ - { os: windows-latest, target: x64, rustflags: "-C target-cpu=x86-64-v3" }
44
+ runs-on: ${{ matrix.os }}
45
+ env:
46
+ RUSTFLAGS: ${{ matrix.rustflags }}
47
+ steps:
48
+ - uses: actions/checkout@v5
49
+ - uses: actions/setup-python@v6
50
+ with:
51
+ python-version: "3.12"
52
+ - uses: PyO3/maturin-action@v1
53
+ with:
54
+ working-directory: python
55
+ target: ${{ matrix.target }}
56
+ args: --release --out dist
57
+ manylinux: auto
58
+ docker-options: -e RUSTFLAGS
59
+ - name: Check the x86-64 Linux wheel
60
+ if: matrix.os == 'ubuntu-latest' && matrix.target == 'x86_64'
61
+ run: |
62
+ python -m pip install python/dist/*.whl
63
+ python -c "import qevedo.simulator as s; assert s.uses_avx2(); print(s.run(s.Circuit(2).h(0).cx(0, 1).t(1).measure_all(), 100, seed=1).counts)"
64
+ - uses: actions/upload-artifact@v4
65
+ with:
66
+ name: wheels-${{ matrix.os }}-${{ matrix.target }}
67
+ path: python/dist/
68
+
69
+ sdist:
70
+ needs: [ci, check]
71
+ runs-on: ubuntu-latest
72
+ steps:
73
+ - uses: actions/checkout@v5
74
+ - uses: PyO3/maturin-action@v1
75
+ with:
76
+ working-directory: python
77
+ command: sdist
78
+ args: --out dist
79
+ - uses: actions/upload-artifact@v4
80
+ with:
81
+ name: sdist
82
+ path: python/dist/
83
+
84
+ publish:
85
+ needs: [wheels, sdist]
86
+ runs-on: ubuntu-latest
87
+ environment:
88
+ name: pypi
89
+ url: https://pypi.org/project/qevedo-simulator/
90
+ permissions:
91
+ id-token: write
92
+ steps:
93
+ - uses: actions/download-artifact@v4
94
+ with:
95
+ path: dist
96
+ merge-multiple: true
97
+ - uses: pypa/gh-action-pypi-publish@release/v1
98
+
99
+ github-release:
100
+ needs: publish
101
+ runs-on: ubuntu-latest
102
+ permissions:
103
+ contents: write
104
+ steps:
105
+ - uses: actions/download-artifact@v4
106
+ with:
107
+ path: dist
108
+ merge-multiple: true
109
+ - name: Create the GitHub release
110
+ env:
111
+ GH_TOKEN: ${{ github.token }}
112
+ run: gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes
@@ -0,0 +1,8 @@
1
+ /target
2
+ /.bench-venv
3
+ __pycache__
4
+ /python/target
5
+ /python/python/qevedo/simulator/*.so
6
+ /python/python/qevedo/simulator/*.pyd
7
+ /python/dist
8
+ .pytest_cache