GPU-accelerated quantitative research kernels. Kernel × quant.
Project description
kuant
GPU-accelerated quantitative research kernels. kernel × quant.
Vision
Standard quant libraries stop at technical indicators and portfolio math. kuant additionally exposes:
- Sparse Identification of Nonlinear Dynamics (SINDy) — null-testing tools for feature discovery, distilled from real production research
- Quantum-inspired regime discovery — HMM state machines, Bell- inequality-style aggregation tests, retrain-frequency (Zeno) scans
- Topological Data Analysis (TDA) — persistent homology, Mapper algorithm (planned)
Combined with GPU-batched primitives (Black-Scholes, rolling statistics, implied-vol solvers), kuant is a research-grade toolkit for signal discovery — not just an implementation of textbook indicators.
Status
Alpha. 955 tests across 5 shipped subpackages:
| Subpackage | Kernels | Highlights |
|---|---|---|
kuant.core |
16 | BS pricing (bscall/bsput) + full Gaussian family (normcdf/normpdf/normppf + log-tails) + Student-t (tcdf/tpdf/tppf + log-tails) + Generalized Pareto (gpdcdf/gpdpdf/gpdppf) + logsumexp |
kuant.options |
21 | First-order Greeks (delta/gamma/vega/rho/theta/charm) + second-order (vanna/volga/speed/zomma/color) + payoffs + chain filters + Newton and bisection implied-vol solvers |
kuant.stats |
19 | Rolling primitives with strict-window NaN, plus Hurst (R/S) and rolling Hurst |
kuant.qm |
5 + hmm/ghmm subpackages |
HMM/GHMM inference (forward/backward/viterbi/posterior) + belltest, zenoscan, posteriorentropy, nocloningscan, decoherencescan |
kuant.sindy |
6 | permtest, grangerscan, sindylasso, pinnscan, symbolicscan, accelerationscan |
Each kernel has:
- Full API doc under
docs/kernels/ - CPU fallback (numpy path — works on any machine)
- GPU path (cupy — same math, verified for parity)
- Cross-checked test suite (golden values, library reference, cross-kernel identities, machine-precision fd tolerances)
Install
# CPU-only
pip install kuant
# With GPU
pip install kuant[gpu]
# Some tools have optional heavy dependencies (scikit-learn for belltest,
# statsmodels for grangerscan). Install those separately when needed:
pip install scikit-learn statsmodels
Documentation
docs/kernels/— per-kernel API docs, one per kernel, organized intocore/,options/,stats/,qm/,sindy/docs/design/— cross-cutting design decisionsdocs/examples/— worked examples
Start at docs/README.md.
Quick start
import numpy as np
from kuant.core import bsput, bsputdelta, normcdf
from kuant.stats import rollmean, rollstd, zscore, rollcorr
from kuant.options import impvol
from kuant.qm.hmm import forward, viterbi
# Vectorized Black-Scholes put pricing
strikes = np.linspace(80, 120, 41)
prices = bsput(S=100.0, K=strikes, T=1.0, r=0.05, sigma=0.20)
# Invert market prices to implied vol
sigma_iv = impvol(prices, S=100.0, K=strikes, T=1.0, r=0.05, is_call=False)
# Rolling z-score of returns
z = zscore(returns, window=252)
# HMM state decoding
states, log_prob = viterbi(observations, pi, A, B)
Repository layout
kuant/
├── core/ Mathematical primitives (BS family, normal CDF/PDF)
├── options/ Options analytics (impvol solver)
├── stats/ Rolling and windowed statistics (18 kernels)
├── qm/ Quantum-inspired tools (HMM, belltest, zenoscan)
├── sindy/ SINDy-adjacent null-testing tools (permtest, grangerscan)
├── portfolio/ P&L, drawdown, Sharpe (skeleton)
├── backtest/ Simulation engine (skeleton)
├── signals/ Signal computation (skeleton)
├── topology/ TDA (skeleton)
├── text/ Text parsing (skeleton)
├── data/ Bar aggregation (skeleton)
├── edgecases/ Edge case utilities (skeleton)
└── queueing/ Hardware throttle + coordination layer
docs/
├── kernels/ One doc per kernel (grouped by subpackage)
├── design/ Cross-cutting design docs
└── examples/ Worked examples
tests/ 1:1 with kernel files; 887 tests total
Design principles
- CPU-first, GPU-second — every kernel has a numpy fallback so development works on any machine
- Batched by default — kernels operate on tensors, not scalars; single scalar case is a special call
- Explicit edge cases — NaN, zero denominators, empty arrays, past-expiry options all handled in-kernel; callers don't need defensive wrappers
- Composable primitives — each kernel does one thing; complex operations build up from atoms
- Reproducible — kernels don't touch global state; same inputs guarantee same outputs
- No underscores in the API surface —
bsput, notbs_put;belltest, notbell_test. Improves typing flow
Contributing
Contribution guidelines coming as project matures.
License
Apache 2.0. See LICENSE.
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 Distribution
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 kuant-0.1.0.tar.gz.
File metadata
- Download URL: kuant-0.1.0.tar.gz
- Upload date:
- Size: 81.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a668c843f4a43cf4e298a8461876c75e661d7746da16d1ce5acae5ea1a9d1281
|
|
| MD5 |
fb1e404a452c3dbfe15c90848cca78d4
|
|
| BLAKE2b-256 |
7e0f9128a6a2079982c9c904872491b80cbcb9405aa976ae0b7b7acadc481065
|
File details
Details for the file kuant-0.1.0-py3-none-any.whl.
File metadata
- Download URL: kuant-0.1.0-py3-none-any.whl
- Upload date:
- Size: 131.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86851b757c9d415fe4d135738e9c77765fc81da6c7ee589c0f99bf68eca0ba04
|
|
| MD5 |
2e66645fdf5da6c272bc6a0c609e676b
|
|
| BLAKE2b-256 |
fc435baad293b553d62d7012ab1e5604d8bcaa6bd064b2b9d28631ac11d19ad9
|