Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

NumFast

High-performance numerical computing for Python — GPU acceleration without writing CUDA.

pip install numfast
import numfast as nf

s = nf.series([1.0, 2.0, 3.0, 4.0])

y = (s * 2 + 1).compute()
print(y.data())          # [3.0, 5.0, 7.0, 9.0]

peaks = (s > 2).filter(s)   # comparison -> mask -> gather
print(peaks.data())         # [3.0, 4.0]

print(nf.mean(y))           # 6.0

Creation — GPU-resident arrays, no host staging

import numfast as nf

x = nf.zeros(1_000_000)                              # float32 zeros on device
o = nf.ones(500_000, dtype="int32")
g = nf.arange(0, 10, 2)                              # [0, 2, 4, 6, 8]
i = nf.index(1_000_000)                              # int32 0..n-1, exact up to 2^31
t = nf.tile([1, 2, 3], 9)                            # [1,2,3,1,2,3,...]
u = nf.random.uniform(shape=1_000_000, seed=42)      # deterministic, bit-exact
n = nf.random.normal(loc=0.0, scale=1.0, shape=100_000, seed=42)
r = nf.random.integers(low=1, high=7, shape=1_000, seed=42, dtype="int32")

Same seed + same index = same value — bit-identical across runs.

Series + filter + stats — real outputs

Derived from docs/EXAMPLES.md (E1-E3, E5, E7), verified against the public API:

import numfast as nf

# E1. Million-element arithmetic
s = nf.series(list(range(1_000_000)))
y = (s * 2 + 1).compute()
print(len(y), y.data()[:3])               # 1000000 [1.0, 3.0, 5.0]

# E3. Deterministic random
a = nf.random.uniform(shape=5, seed=42).to_numpy()
b = nf.random.uniform(shape=5, seed=42).to_numpy()
print((a == b).all())                     # True — same seed, same stream

# E5. Filter (comparison -> mask -> gather)
s = nf.series([1.0, 5.0, 2.0, 8.0, 3.0])
big = (s > 4).filter(s)
print(big.data())                         # [5.0, 8.0]

# E7. Statistics
s = nf.series([1.0, 2.0, 3.0])
print(nf.mean(s), nf.std(s), nf.var(s), nf.total(s), nf.count(s))
# 2.0 0.816... 0.666... 6.0 3

# Chained expressions are lazy DAGs, executed once on .compute()
s = nf.series([1.0, 2.0, 3.0, 4.0])
y = (s * 2 + 1).compute()
print(y.data())                           # [3.0, 5.0, 7.0, 9.0]
print(nf.mean(y), nf.minimum(y), nf.maximum(y))  # 6.0 3.0 9.0

Note: the first .compute() call includes pipeline warm-up (seconds on some machines); subsequent calls reuse compiled plans and are fast.

GroupBy / TopK + diagnostics

import numfast as nf

# Top-K — largest k elements
s = nf.series([5.0, 1.0, 8.0])
print(nf.topk(s, 2))                      # [8. 5.]

# GroupBy — keys/vals are host arrays via .data()
keys = nf.series([0.0, 1.0, 0.0, 1.0])
vals = nf.series([1.0, 3.0, 2.0, 4.0])
res = nf.groupby(keys.data(), vals.data())
# res["keys"], res["count"], res["sum"], res["min"], res["max"], res["mean"]

# Device & profiling
print(nf.device_info())                   # {'backend': ..., 'platform': ..., 'version': ...}
nf.set_backend("cpu")                     # or "gpu" when available

with nf.profile():
    y = (s * 2 + 1).compute()             # stage breakdown printed (ms per stage)

Arrays above 4_194_240 elements raise ValueError("chunking planned") in v1.

What's inside

Group API
Creation zeros ones full arange linspace index tile repeat
Random random.uniform random.normal random.integers (explicit seed)
Series lazy expressions + - * / % **, comparisons < <= > >= == !=, .filter(mask), .compute()
Math sin cos tan exp log sqrt abs square neg
Statistics mean std var total minimum maximum count
Tabular topk(s, k), groupby(keys, vals)
Operations scan sort histogram matmul fft
Diagnostics device_info() set_backend(...) profile()

When NumFast is fast

Measured characterizations (RTX 2060, details in docs/PERFORMANCE.md):

  • fusion-friendly pipelines and parameter batches: 8-31x vs NumPy
  • elementwise Filter compositions: up to 334x
  • recursive per-element chains (e.g. Wilder RSI): CPU may win — we say so honestly

Honest limits (see docs/LIMITATIONS.md): rank-1 only in v1, no int64, log(0) raises, gather with int32 index not yet on GPU path, first call pays warm-up cost, serial IIR dependencies are latency-bound.

Documentation

Status

1.0.0a1 · Python 3.10+ · License: see LICENSE

Metadata

Release files for numfast 1.0.0a2

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

Source distribution (sdist)

Source distribution for numfast 1.0.0a2
File Size Uploaded Provenance Actions
numfast-1.0.0a2.tar.gz 520.0 kB Without provenance Details for numfast-1.0.0a2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for numfast 1.0.0a2
File Interpreter ABI Platform Actions
numfast-1.0.0a2-py3-none-any.whl Python 3 none any Details for numfast-1.0.0a2-py3-none-any.whl

Total release size: 978.2 kB

Release files / numfast-1.0.0a2.tar.gz

Download URL numfast-1.0.0a2.tar.gz
Size 520.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e10f8eb84437c3b00ea0e26cfab2c5dfb80adb03018c67ea5d1cd43b3f6432b4
BLAKE2b-256 checksum
How to use checksums
f4b5910c43b1e03761a9a761899f9465cc3f9b68a8275bab14ea0cef22c13fdf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / numfast-1.0.0a2-py3-none-any.whl

Download URL numfast-1.0.0a2-py3-none-any.whl
Size 458.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
63ae6ea5c4b58e5344637141183c0256772b7d822bcba65998c7c439b9165bf9
BLAKE2b-256 checksum
How to use checksums
7bcd08074cde25f98a1475a1c714794e52d51869d58b059f7b4fbbb0b82d3f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for numfast 1.0.0a2

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.

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