Optimization, ODE, DAE, and PDE solvers, interpolation, statistics, signal processing, and spatial algorithms, built on numr. The crate exposes 13 public modules.
Docs · Crate · Modules · Example · Contributing
solvr is a scientific computing library for Rust. It fills the role SciPy has in Python: optimization, ODE solvers, interpolation, statistics, signal processing, and spatial algorithms. It provides these algorithms on numr tensors and runtimes. The CPU backend is the default. CUDA and WebGPU are optional features.
- The algorithms are written in Rust. No Python is needed.
- solvr builds on numr, which is the NumPy role. See For SciPy Users for the module map.
- Not supported yet: WebGPU computes in
F32only.
Add solvr and numr. The examples create numr devices and clients.
cargo add solvr numrFor GPU backends, enable the matching feature:
cargo add solvr --features cuda # NVIDIA GPUs, CUDA 12.8+ or 13.x
cargo add solvr --features wgpu # WebGPUDefault features: graph, pde.
| Feature | Description | Default |
|---|---|---|
graph |
Graph algorithms module. Enables sparse. |
✓ |
pde |
PDE module. Enables sparse. |
✓ |
sparse |
Sparse tensor support through numr/sparse |
✗ |
cuda |
CUDA backend through numr/cuda |
✗ |
wgpu |
WebGPU backend through numr/wgpu |
✗ |
f16 |
Half-precision support through numr/f16 |
✗ |
WebGPU computes in F32 only. The CUDA backend needs the CUDA toolchain that numr requires.
use numr::dtype::DType;
use numr::ops::RandomOps;
use numr::runtime::RuntimeClient;
use numr::runtime::cpu::{CpuClient, CpuDevice};
use solvr::signal::{ConvMode, ConvolutionAlgorithms};
use solvr::window::WindowFunctions;
fn main() -> solvr::Result<()> {
let device = CpuDevice::new();
let client = CpuClient::new(device.clone());
// Create a Hann window
let _window = client.hann_window(256, DType::F32, &device)?;
// Convolve two random signals
let signal = client.randn(&[256], DType::F32)?;
let kernel = client.randn(&[32], DType::F32)?;
let _result = client.convolve(&signal, &kernel, ConvMode::Same)?;
Ok(())
}The algorithm calls stay the same on any backend that implements the operation. Only the device and client types change.
| Module | Contents |
|---|---|
signal |
Convolution, correlation, STFT and inverse STFT, spectrograms, spectral analysis, N-D filters, edge operations |
window |
Window generators: Hann, Hamming, Blackman, Kaiser, and related windows |
interpolate |
1D and N-D interpolation, splines, PCHIP, Akima, RBF, geometric transforms |
optimize |
Scalar optimization, root finding, minimization, least squares, LP, QP, conic, global methods |
integrate |
Numerical quadrature and ODE, DAE, and BVP solvers |
stats |
Distributions, descriptive statistics, hypothesis tests, regression, information metrics |
spatial |
KDTree, BallTree, distances, convex hull, Delaunay, Voronoi, rotations, mesh operations, distance transforms |
morphology |
Binary and grayscale morphology, connected-region labeling, region measurements |
cluster |
k-means family, DBSCAN, OPTICS, HDBSCAN, GMM and Bayesian GMM, hierarchical, spectral |
linalg |
Matrix-equation solvers (Lyapunov, Riccati, Sylvester), sparse QR, advanced linear algebra helpers |
graph (feature graph) |
Shortest paths, connectivity, centrality, MST, flow, graph matrix algorithms |
pde (feature pde) |
Finite-difference, finite-element, and spectral PDE tooling |
The full algorithm list for each module is in docs/modules.md.
The crate re-exports Tensor, Runtime, RuntimeClient, DType, Result, and Error from numr.
| SciPy area | solvr module(s) |
|---|---|
scipy.signal |
signal, window |
scipy.ndimage |
signal (N-D filters, edge operations), morphology, spatial (distance transform), interpolate (geometric transforms) |
scipy.interpolate |
interpolate |
scipy.optimize |
optimize |
scipy.integrate |
integrate |
scipy.stats |
stats |
scipy.spatial |
spatial |
scipy.cluster |
cluster |
scipy.sparse.csgraph |
graph (feature-gated) |
scipy.linalg |
linalg |
- numr: tensors, FFT, linear algebra, and the
Runtimeabstraction. - solvr: scientific and numerical algorithms built on numr.
- boostr: ML primitives built on numr.
Contributions are welcome. See CONTRIBUTING.md for conventions and checks.
Questions and design discussion happen on Discord.
Licensed under Apache-2.0. See LICENSE.