Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ version = "0.1.0"
edition = "2024"

[dependencies]
fxhash = "0.2.1"
num = "0.4.3"
ppvm-pauli-sum = { version = "0.1.0", path = "crates/ppvm-pauli-sum" }
ppvm-tableau = { version = "0.1.0", path = "crates/ppvm-tableau" }
ppvm-sym = { version = "0.1.0", path = "crates/ppvm-sym" }
Expand Down
1 change: 0 additions & 1 deletion crates/ppvm-python-native/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ test = false

[dependencies]
bnum = "0.13.0"
num = "0.4.3"
paste = "1.0.15"
ppvm-pauli-sum = { version = "0.1.0", path = "../ppvm-pauli-sum" }
ppvm-stim = { version = "0.1.0", path = "../ppvm-stim", features = ["rayon"] }
Expand Down
1 change: 0 additions & 1 deletion crates/ppvm-tableau-sum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ bitvec = "1.0.1"
fxhash = "0.2.1"
num = "0.4.3"
ppvm-traits = { version = "0.1.0", path = "../ppvm-traits" }
ppvm-pauli-word = { version = "0.1.0", path = "../ppvm-pauli-word" }
ppvm-pauli-sum = { version = "0.1.0", path = "../ppvm-pauli-sum" }
ppvm-tableau = { version = "0.1.0", path = "../ppvm-tableau" }
rand = "0.10.1"
Expand Down
13 changes: 13 additions & 0 deletions docs/src/pages/develop.astro
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,18 @@ npm run build # extract everything, then `astro build` → dist/</code>
runners only start once Linux is fully green.
</li>
</ol>
<p>
<strong>Unused dependencies.</strong> A <code>cargo-machete</code>
<code>prek</code> hook flags unused crate dependencies across the whole
workspace (run from the repo root, <a href="https://github.com/bnjbvr/cargo-machete">cargo-machete</a>
recurses into every member). It is part of the hook suite, so it runs both
locally on commit and in CI via the <code>pre-commit</code> job — there is
no separate machete CI job. The binary is provisioned by <code>mise</code>
(<code>cargo:cargo-machete</code> in <code>mise.toml</code>), so the
mise-action step that sets up the other hooks installs it too. Silence a
false positive per-crate with
<code>[package.metadata.cargo-machete] ignored = [&hellip;]</code>.
</p>
<p>
<strong>Why cross-OS is extension-only.</strong> The compiled PyO3
module is the only artifact whose build is OS-sensitive — macOS needs
Expand Down Expand Up @@ -616,6 +628,7 @@ chore: restore lockfile consistency</code></pre>
<ul>
<li>Run <code>cargo fmt --all</code> before committing Rust.</li>
<li>Run <code>cargo clippy --workspace --all-targets</code>; fix or justify all warnings.</li>
<li>Run <code>cargo machete</code> to catch unused dependencies; it's also a <code>prek</code> hook, run on commit and in CI.</li>
<li>Python is formatted with <code>ruff format</code> and linted with <code>ruff check</code>.</li>
<li>Public Rust items should have doc comments; <code>cargo doc --no-deps</code> must build cleanly because the API site is built from rustdoc JSON.</li>
<li>
Expand Down
2 changes: 2 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
prek = "latest"
# License header checker/formatter (used by prek hawkeye hook)
"github:korandoru/hawkeye" = "latest"
# Unused-dependency checker
"cargo:cargo-machete" = "0.9.2"
32 changes: 32 additions & 0 deletions ppvm-python/demo/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Encode a message into a computational-basis state with GeneralizedTableau.

Each bit of the ASCII encoding of "Hello, world!" gets one qubit. Starting
from the all-zero state, we flip every qubit whose target bit is 1 with an X
gate, then measure all qubits back out and decode them into the string.
"""

from ppvm import GeneralizedTableau

MESSAGE = "Hello, world!"

# ASCII bytes -> bit list, MSB first within each byte.
data = MESSAGE.encode("ascii")
bits = [(byte >> (7 - i)) & 1 for byte in data for i in range(8)]

# One qubit per bit; flip every qubit whose target bit is 1.
tab = GeneralizedTableau(n_qubits=len(bits))
for q, bit in enumerate(bits):
if bit:
tab.x(q)

# Measure all qubits and decode the outcomes back into a string.
measured = [int(tab.measure(q)) for q in range(len(bits))]
decoded = bytes(
int("".join(str(b) for b in measured[i : i + 8]), 2)
for i in range(0, len(measured), 8)
).decode("ascii")

print(f"qubits: {len(bits)}")
print(f"decoded: {decoded!r}")
assert decoded == MESSAGE, f"round-trip failed: {decoded!r}"
print("round-trip OK")
Comment on lines +10 to +32
14 changes: 14 additions & 0 deletions ppvm-python/demo/squin_kernel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from ppvm import GeneralizedTableauSimulator
from bloqade import squin

@squin.kernel
def main():
q = squin.qalloc(2)

squin.h(q[0])
squin.cnot(q[0], q[1])

sim = GeneralizedTableauSimulator(2)
task = sim.task(main)
task.run()
print(task.state)
Comment on lines +11 to +14
15 changes: 15 additions & 0 deletions prek.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ entry = "cargo clippy --workspace -- -D warnings"
pass_filenames = false
types = ["rust"]

# Rust: unused-dependency check across the whole workspace.
# cargo-machete is installed via mise (see mise.toml); `mise exec --` is used so
# the hook works even outside a mise-activated shell. This is the sole machete
# check: it runs locally on commit and in CI via the `pre-commit` job (which
# runs the full hook suite) — there is no separate cargo-machete CI job.
[[repos]]
repo = "local"
[[repos.hooks]]
id = "cargo-machete"
name = "cargo machete (unused deps)"
language = "system"
entry = "mise exec -- cargo-machete"
pass_filenames = false
types = ["rust"]
Comment on lines +62 to +63

# Python: ruff format check
[[repos]]
repo = "local"
Expand Down
Loading