Rust acceleration core for g2n (quantum statevector kernels, token sampling). Optional: g2n falls back to pure torch without it.
Project description
g2n-native
Rust acceleration core for g2n: in-place quantum statevector kernels and fast token sampling.
You normally don't install this directly — pip install g2n[native] pulls it
in on supported platforms (Linux x86_64). g2n detects it at import time and
falls back to its pure-torch paths if it's missing or G2N_NATIVE=0 is set.
API
apply_gates(psi, gates)— apply a gate list in place to a(B, 2**n)complex64 C-contiguous statevector. Each gate is(bit_positions, matrix)withbit = n-1-qubit; matrices are(2,2)/(4,4)shared or(B,2,2)/(B,4,4)per batch row.sample_topp(logits, temperature, top_p, top_k=0, seed=0)— sample one token id from a(V,)f32 logits vector.temperature <= 0means argmax. Deterministic for a given seed.
Parity with the torch reference paths is enforced by
tests/test_native_parity.py in the g2n repo.
Building
maturin build --release --zig --compatibility manylinux_2_28
Proprietary — © g2n.dev.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file g2n_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: g2n_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 282.9 kB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f596c93bd89fbde071caecfa9d3465df9eef25f6c0df6a2fdc64a97cc5eb55c
|
|
| MD5 |
d2c16b130a5ecbeb2418d63b8052ed62
|
|
| BLAKE2b-256 |
a1c8a3ef3764a6fcf3da28d1682d9fd414db91ea33730836ff65971ac6e3ac9a
|