hyperfold
High-performance linear algebra without leaving Python.
A modern C++23 computing core with a NumPy-first API, explicit memory behaviour, and native CPU and CUDA execution.
- PYPython API (NumPy, CuPy and PyTorch)
- APIZero-copy CuPy and PyTorch interchange
- SIMDNative and extensible CPU kernels (natively supporting AVX2, AVX-512 and Apple Silicon NEON)
- CUDANative and extensible CUDA kernels (natively supporting up to the Blackwell architecture)
- 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