Skip to main content

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) with bit = 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 <= 0 means 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.

Metadata

Release files for g2n-native 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for g2n-native 0.1.0
File Interpreter ABI Platform Actions
g2n_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl CPython 3.10 abi3 Linux glibc 2.28+ x86-64 Details for g2n_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl

Release files / g2n_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl

Download URL g2n_native-0.1.0-cp310-abi3-manylinux_2_28_x86_64.whl
Size 282.9 kB
Tags CPython 3.10 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
0f596c93bd89fbde071caecfa9d3465df9eef25f6c0df6a2fdc64a97cc5eb55c
BLAKE2b-256 checksum
How to use checksums
a1c8a3ef3764a6fcf3da28d1682d9fd414db91ea33730836ff65971ac6e3ac9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for g2n-native 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page