Hisab
Hisab (Arabic: حساب — calculation) — higher mathematics library for AGNOS
Higher math for the AGNOS ecosystem. Provides typed mathematical operations — linear algebra, geometry, calculus, numerical methods, automatic differentiation, symbolic algebra, and more — built on glam.
Used by impetus (physics), kiran (engine), joshua (simulation), aethersafha (compositor), svara (vocal synthesis), and prani (creature vocal synthesis).
For expression evaluation and unit conversion, see abaco.
Features
| Feature | Default | Description |
|---|---|---|
transforms |
yes | 2D/3D affine transforms, projections, slerp/lerp, reverse-Z, glam re-exports, HSV/HSL/Oklab color, premultiplied alpha, Porter-Duff compositing, HDR tone mapping (Reinhard, ACES), depth linearization, dual quaternions, CSS decompose, spherical harmonics |
geo |
yes | Primitives (Ray, Plane, AABB, Sphere, OBB, Capsule, Triangle), intersections, closest-point queries, barycentric coordinates, BVH, k-d tree, quadtree, octree, spatial hash, 2D+3D GJK/EPA, MPR/XenoCollide, SAP broadphase, CCD/TOI, sequential impulse with friction, SDFs + CSG, convex decomposition, Delaunay triangulation, Voronoi diagrams, tangent space |
calc |
yes | Differentiation, integration (trapezoidal, Simpson, Gauss-Legendre, adaptive, Monte Carlo), Bezier 2D/3D, Catmull-Rom, B-splines, NURBS, Hermite TCB, monotone cubic (Fritsch-Carlson), easing, spring dynamics, gradient/Jacobian/Hessian, Perlin/fBm noise |
num |
yes | Root finding (Newton-Raphson, bisection), LU/Cholesky/QR/SVD, FFT/DST/DCT/2D-FFT, optimization (GD, CG, BFGS, LM), ODE (RK4, DOPRI45, backward Euler, BDF-2/3/4/5), SDE (Euler-Maruyama, Milstein), symplectic integrators (Euler, Verlet, leapfrog, Yoshida 4th-order), sparse CSR (spmv, spmvt, Cholesky, LU), GMRES, PGS+SOR, BiCGSTAB, eigendecomposition, inertia tensors, Lyapunov exponents, Halton/Sobol sequences, compensated summation (Kahan, Neumaier), PCG32 RNG |
autodiff |
no | Forward-mode (dual numbers) and reverse-mode (tape-based) automatic differentiation |
interval |
no | Interval arithmetic for verified numerics |
symbolic |
no | Symbolic expression tree with evaluation, differentiation, simplification, substitution |
tensor |
no | N-dimensional dense tensor with reshape, matmul, transpose |
parallel |
no | Rayon-powered parallel batch operations (transform, intersection, matvec) |
ai |
no | Daimon/hoosh AI client (network deps) |
logging |
no | Structured logging via HISAB_LOG env var |
full |
— | Enables all features |
Quick Start
[]
= "1.2"
use ;
use ray_sphere;
use integral_simpson;
use newton_raphson;
// 3D transform with composition
let a = new;
let b = new;
let combined = a.compose;
let world_pos = combined.apply_to_point;
// Ray-sphere intersection
let ray = new.unwrap;
let sphere = new.unwrap;
let hit = ray_sphere; // Some(4.0)
// Numerical integration
let area = integral_simpson.unwrap; // ~0.3333
// Root finding
let sqrt2 = newton_raphson.unwrap;
Architecture
See docs/architecture/overview.md for the full module map, data flow, and design principles.
Building
License
GPL-3.0-only — see LICENSE.