Metadata-Version: 2.4
Name: square-rulerpack-native
Version: 0.3.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Rust
Classifier: Topic :: Scientific/Engineering :: Mathematics
License-File: LICENSE
Summary: Lars Rocha's square-rulerpack quadratic sieve (Rust, double large primes, AVX2) compiled as a Python extension: factor 40-100 digit numbers from Python at native speed.
Keywords: quadratic-sieve,siqs,factorization,number-theory,rust,pyo3
Author: Lars Rocha
License-Expression: MIT
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/oppressionslayer/square-rulerpack-py
Project-URL: Pure Python package, https://pypi.org/project/square-rulerpack/
Project-URL: Rust crate, https://crates.io/crates/square-rulerpack

# square-rulerpack-native

Lars Rocha's [square-rulerpack](https://crates.io/crates/square-rulerpack) factoring engine
(self-initialising quadratic sieve with double large primes, AVX2 kernels, rayon threads, in Rust)
compiled as a Python extension module with PyO3. It is the fast path of the pure-Python
[square-rulerpack](https://pypi.org/project/square-rulerpack/) package, which does the teaching;
this module does the factoring.

```sh
pip install square-rulerpack[native]      # or: pip install square-rulerpack-native
```

```python
import square_rulerpack_native as srn
srn.factor_completely(50726044447758565750355444206008211963939957754977146054012847169421070122136537, threads=8)
srn.factor(n, threads=8)                  # one nontrivial factor from the sieve, or None
srn.is_prime(2**61 - 1)                   # strong probable-prime test
srn.factor_completely(n, threads=8, progress=lambda stage, full, need, partials, polys: print(stage, full, need))
```

Through the pure package it is the default engine once installed:

```python
import square_rulerpack as sq
sq.factor_completely(n, workers=8)        # engine="auto": Rust when installed, Python otherwise
```

Python ints cross as big integers (no string round trip). The GIL is released while the sieve
runs; Ctrl-C does not interrupt it. The engine's switches (`SIQS_Q2`, `SIQS_SMALL`, `SIQS_EXACT`,
`SIQS_DLP`, …) are read from the environment at call time, exactly as the Rust CLI reads them;
the pure package sets them from its `Settings`. Wheels are abi3 (one wheel per platform for
every Python ≥ 3.10); building from the sdist needs a Rust toolchain.

MIT, as the crate.

