Home › Numerics & scientific computing

Numerics & scientific computing

Differential equations, linear algebra, FFT, floating point, optimization and randomness.

ODE solvers

Stepping ordinary differential equations forward in time.

Physics integrators

Long-run stable motion for simulations and games.

PDE methods

Fields over space and time.

Finite differences

Replace derivatives with weighted differences of grid values; simple stencils plus a stability condition (CFL) turn PDEs like heat, advection and waves into array loops.

explicit step O(N) per time step, memory-bound; implicit 1D step O(N) with the Thomas algorithm; stable Δt ∝ Δx (hyperbolic) or Δx² (parabolic)

Finite elements

Writes the PDE in weak form, approximates it with piecewise polynomials on a mesh and assembles a sparse system; handles any geometry.

assembly O(elements); sparse SPD system with order of 7 (2D P1) to 15 (3D P1) nonzeros per row; κ = O(h⁻²), so CG needs O(h⁻¹) iterations without preconditioning

Spectral methods

Represent the solution by a global Fourier or Chebyshev series; derivatives become multiplications by ik in coefficient space, giving exponential convergence for smooth problems.

O(N log N) per derivative via FFT; error decays like e^(−cN) for analytic solutions; explicit time step O(1/N) advection, O(1/N²) diffusion (Fourier), O(1/N⁴) diffusion (Chebyshev)

finite volume method

Planned.

flux limiters upwinding

Planned.

level set methods

Planned.

unstructured mesh representation

Planned.

spherical grids

Planned.

spherical harmonic transform

Planned.

conservative regridding

Planned.

data assimilation 4dvar

Planned.

ensemble kalman filter

Planned.

Gaussian quadrature

Approximate an integral by a weighted sum of n function values at roots of orthogonal polynomials; exact for polynomials up to degree 2n-1.

n evaluations of f; exact to degree 2n-1; geometric error decay for analytic integrands; nodes cost O(n²) by Newton or O(n) by asymptotics

Linear algebra

Solving Ax = b, dense and sparse.

LU and Cholesky factorization

Factor A = PLU (any square matrix, partial pivoting) or A = LLᵀ (SPD) once in O(n³), then solve each right-hand side in O(n²).

LU 2n³/3 flops, Cholesky n³/3 flops; each solve 2n² flops; memory n² (in place)

Sparse matrices (CSR)

Compressed sparse row stores only nonzeros as row pointers, column indices and values; SpMV streams them once, so it is memory-bandwidth bound.

memory 12·nnz + 8·(n+1) bytes (f64 values, u32 columns, usize pointers); SpMV O(nnz), about 2 flops per 12-20 bytes moved

Conjugate gradient

Krylov iteration for symmetric positive definite Ax = b using one matrix-vector product and two dot products per step; converges in about √κ iterations.

per iteration 1 SpMV + 2 dots + 3 axpys; iterations to reduce error by ε about ½·√κ·ln(2/ε); memory 4-5 vectors

Multigrid

Smooths high-frequency error on the fine grid and solves the smooth remainder on coarser grids; O(n) elliptic solves at any resolution.

one V-cycle about 4/3 × (cost of the fine-level smoothing + residual) in 2D, 8/7 in 3D; about 9 V(2,2) cycles to a 10⁻¹⁰ residual reduction on 2D Poisson at any size; O(n) total

gmres

Planned.

Sparse direct solver

Solve sparse Ax = b exactly by reordering, symbolic analysis, numeric LLᵀ/LU and triangular solves; fill-in, not flops per entry, decides the cost.

2D grid with nested dissection nnz(L) O(n log n), flops O(n^1.5); 3D nnz(L) O(n^(4/3)), flops O(n²); solve phase O(nnz(L))

Fill-reducing ordering

Permute a sparse symmetric matrix before Cholesky/LU so the factor has few new nonzeros; minimum degree, nested dissection and RCM trade quality, speed and parallelism.

ordering heuristics near O(nnz(A)) (AMD) to O(nnz) multilevel (METIS); optimal minimum fill is NP-complete; nested dissection on a 2D mesh gives nnz(L) O(n log n)

Incomplete factorization preconditioners

Sparse approximate LU or Cholesky factors (ILU, IC) that precondition Krylov solvers: fewer iterations than Jacobi, less memory than a direct solve.

factor about O(nnz) for IC(0)/ILU(0); apply O(nnz(L+U)), sequential

thomas tridiagonal solver

Planned.

Core numerics

The primitives under everything else.

Optimization & randomness

Minimizing functions and sampling.

Sampling & Bayesian inference

Drawing samples and approximating posteriors.

markov chain monte carlo

Planned.

hamiltonian monte carlo nuts

Planned.

mcmc convergence diagnostics

Planned.

sequential monte carlo

Planned.

variational inference

Planned.

importance sampling

Planned.

low discrepancy sequences

Planned.

alias method sampling

Planned.

Simulation methods

Discrete-event, agent-based, traffic, circuit and orbital simulation.

discrete event simulation

Planned.

agent based modeling

Planned.

fmi co simulation

Planned.

modified nodal analysis

Planned.

gillespie algorithm

Planned.

orbit propagation

Planned.

car following models

Planned.

lane change models

Planned.

dynamic traffic assignment

Planned.

Symbolic math

Computer algebra on polynomials and expressions.

groebner bases

Planned.

polynomial gcd factorization

Planned.

symbolic integration

Planned.

Quantum computing

Compiling and simulating quantum circuits, and error correction.

quantum circuit optimization

Planned.

quantum gate synthesis

Planned.

qubit routing

Planned.

stabilizer simulation

Planned.

state vector simulation

Planned.

surface code

Planned.

tensor network contraction

Planned.