hyperfold
Native high-performance linear algebra for Python.
Hyperfold combines a modern C++23 computing core with a NumPy-first API, explicit memory behaviour, and native CPU and CUDA execution.
- PYPython API for NumPy, CuPy and PyTorch
- APIZero-copy interchange with CuPy and PyTorch
- SIMDExtensible CPU kernels for AVX2, AVX-512, ARM NEON and Apple Silicon
- CUDAExtensible CUDA kernels with native support through NVIDIA Blackwell
- LINALGDense and structured linear algebra
- SOLVERSolver and factorisation pipelines
import cupy as cp
import torch
import hyperfold as hf
H = [[4, 1-1j], [1+1j, 3]] # Hermitian
A = cp.asarray(H, dtype=cp.complex64)
b = cp.asarray([1+2j, 3-1j], A.dtype)
lu = hf.lu_factor(A) # factor once
x1 = lu.solve(b)
x2 = lu.solve(2 * b) # solve many
t = torch.ones(8, device="cuda")
y = hf.scale(t, 2) # zero-copy