Skip to content

Commit dd3e493

Browse files
authored
Clifford rz simulators (#278)
* Introduce CliffordRz sim
1 parent e2fcec3 commit dd3e493

134 files changed

Lines changed: 13057 additions & 1007 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/selene-plugins.yml

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,50 +58,50 @@ jobs:
5858
- name: Cache Rust
5959
uses: Swatinem/rust-cache@v2
6060

61-
- name: Build Selene plugins (Unix)
61+
- name: Build and install Selene plugins (Unix)
6262
if: runner.os != 'Windows'
6363
run: |
64-
cargo build --release \
65-
-p pecos-selene-stabilizer \
66-
-p pecos-selene-statevec
67-
68-
- name: Build Selene plugins (Windows)
69-
if: runner.os == 'Windows'
70-
shell: pwsh
71-
run: |
72-
cargo build --release -p pecos-selene-stabilizer -p pecos-selene-statevec
73-
74-
- name: Copy libraries to Python packages (Unix)
75-
if: runner.os != 'Windows'
76-
run: |
77-
# Determine library extension
7864
if [[ "${{ runner.os }}" == "macOS" ]]; then
7965
EXT="dylib"
8066
else
8167
EXT="so"
8268
fi
8369
84-
# Copy libraries
85-
mkdir -p python/selene-plugins/pecos-selene-stabilizer/python/pecos_selene_stabilizer/_dist/lib
86-
mkdir -p python/selene-plugins/pecos-selene-statevec/python/pecos_selene_statevec/_dist/lib
87-
88-
cp target/release/libpecos_selene_stabilizer.$EXT python/selene-plugins/pecos-selene-stabilizer/python/pecos_selene_stabilizer/_dist/lib/
89-
cp target/release/libpecos_selene_statevec.$EXT python/selene-plugins/pecos-selene-statevec/python/pecos_selene_statevec/_dist/lib/
90-
91-
- name: Copy libraries to Python packages (Windows)
70+
# Discover all selene plugins, build, copy libraries, and install
71+
CARGO_ARGS=""
72+
for DIR in python/selene-plugins/pecos-selene-*/; do
73+
PLUGIN=$(basename "$DIR")
74+
CARGO_ARGS="$CARGO_ARGS -p $PLUGIN"
75+
done
76+
cargo build --release $CARGO_ARGS
77+
78+
for DIR in python/selene-plugins/pecos-selene-*/; do
79+
PLUGIN=$(basename "$DIR")
80+
LIB_NAME=$(echo "$PLUGIN" | tr '-' '_')
81+
DEST="python/selene-plugins/$PLUGIN/python/${LIB_NAME}/_dist/lib"
82+
mkdir -p "$DEST"
83+
cp "target/release/lib${LIB_NAME}.$EXT" "$DEST/"
84+
uv pip install --system -e "${DIR}[test]"
85+
done
86+
87+
- name: Build and install Selene plugins (Windows)
9288
if: runner.os == 'Windows'
9389
shell: pwsh
9490
run: |
95-
New-Item -ItemType Directory -Force -Path python/selene-plugins/pecos-selene-stabilizer/python/pecos_selene_stabilizer/_dist/lib
96-
New-Item -ItemType Directory -Force -Path python/selene-plugins/pecos-selene-statevec/python/pecos_selene_statevec/_dist/lib
91+
$plugins = Get-ChildItem -Directory python/selene-plugins/pecos-selene-* | Select-Object -ExpandProperty Name
92+
$cargoArgs = $plugins | ForEach-Object { "-p"; $_ }
93+
cargo build --release @cargoArgs
9794
98-
Copy-Item target/release/pecos_selene_stabilizer.dll python/selene-plugins/pecos-selene-stabilizer/python/pecos_selene_stabilizer/_dist/lib/
99-
Copy-Item target/release/pecos_selene_statevec.dll python/selene-plugins/pecos-selene-statevec/python/pecos_selene_statevec/_dist/lib/
95+
foreach ($plugin in $plugins) {
96+
$libName = $plugin -replace '-', '_'
97+
$dest = "python/selene-plugins/$plugin/python/$libName/_dist/lib"
98+
New-Item -ItemType Directory -Force -Path $dest
99+
Copy-Item "target/release/$libName.dll" "$dest/"
100+
}
100101
101-
- name: Install Python packages
102-
run: |
103-
uv pip install --system -e ./python/selene-plugins/pecos-selene-stabilizer[test]
104-
uv pip install --system -e ./python/selene-plugins/pecos-selene-statevec[test]
102+
foreach ($pluginDir in (Get-ChildItem -Directory python/selene-plugins/pecos-selene-*)) {
103+
uv pip install --system -e "$($pluginDir.FullName)[test]"
104+
}
105105
106106
- name: Run tests
107107
run: |
@@ -120,6 +120,8 @@ jobs:
120120
package: pecos_selene_stabilizer
121121
- name: pecos-selene-statevec
122122
package: pecos_selene_statevec
123+
- name: pecos-selene-clifford-rz
124+
package: pecos_selene_clifford_rz
123125

124126
steps:
125127
- uses: actions/checkout@v6

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
**.DS_Store
33
tmp/
44
**/.*/settings.local.json
5+
**/worktrees/
56

67
# LLVM (extracted from archive for Windows development)
78
/llvm/

0 commit comments

Comments
 (0)