Haskell modules¶
Select a module below or in the sidebar to read its public types, function signatures, input requirements, results, and failure conditions. Search accepts function names as well as descriptive terms. Module pages are generated from the same source revision as this site, including function, method, and record field documentation.
| Area | Representative modules |
|---|---|
| Foundations | HMath, HMath.Error, HMath.Numeric, HMath.Constants, HMath.Units |
| Algebra | HMath.Algebra, HMath.Polynomial, HMath.NumberTheory, HMath.Combinatorics |
| Linear algebra | HMath.Linear, HMath.Matrix, HMath.Matrix.LU, HMath.Matrix.QR, HMath.Sparse |
| Calculus and solvers | HMath.Calculus, HMath.Root, HMath.ODE, HMath.PDE, HMath.Interpolation |
| Optimization | HMath.Optimization, HMath.Autodiff |
| Statistics | HMath.Statistics, HMath.Probability, HMath.Random, HMath.TimeSeries |
| Learning | HMath.MachineLearning, HMath.DeepLearning |
| Transforms and signals | HMath.Fourier, HMath.Signal |
| Geometry and images | HMath.Geometry, HMath.Image, HMath.Rotation, HMath.Quaternion |
| Discrete and symbolic | HMath.Graph, HMath.Discrete, HMath.Symbolic, HMath.Expression |
| Arrays and interchange | HMath.Tensor, HMath.Interchange, HMath.API |
The HMath facade re-exports selected foundational modules. Import additional
modules explicitly for other numerical domains. Checked APIs generally
return Either MathError; consult the function signature for the exact
error and result types.
Read a checked result¶
The Haskell API covers more numerical domains than the C, Wave, and Python bindings. Those bindings currently expose the native scalar/tensor interface; a Haskell-only function is not automatically available in Python.
import qualified HMath.Scalar as Scalar
import qualified HMath.Matrix as Matrix
import qualified HMath.Matrix.LU as LU
main :: IO ()
main = do
print (Scalar.divide (6 :: Double) 2) -- Right 3.0
print (Scalar.divide (1 :: Double) 0) -- Left (DomainError ...)
let solution = do
a <- Matrix.fromListChecked 2 2 [2, 0, 0, 4 :: Double]
LU.solve a [6, 8]
print solution -- Right [3.0,2.0]
An Either result distinguishes input/numerical failure (Left) from an
accepted result (Right). Solver report fields additionally distinguish a
budget stop from convergence. Pure legacy functions such as HMath.Basic.factorial
and HMath.Statistics.mean can raise errors on invalid input; their entries
state those preconditions. IEEE/generic arithmetic APIs can retain host-type
overflow or NaN behavior when their contract does not add finite checks.
Build the complete local site with:
The dense linear algebra guide describes matrix shapes, checked operations, and zero-dimensional matrices in more detail.
All public modules¶
Select a module for its types, constructors, method signatures and function contracts.
Foundations¶
| Module | Purpose |
|---|---|
| HMath.API.Algebra | Small law-oriented numeric interfaces. |
| HMath.API.Buffer | Checked containers and copying conversion boundaries. |
| HMath.API.Convergence | Uniform iteration reports retain the best current estimate on an exhausted budget. |
| HMath.API.Shape | Runtime-checked shapes and nominal type-indexed matrices/tensors. |
| HMath.Basic | Public types and operations. |
| HMath.Constants | Constants with machine-readable provenance and uncertainty. |
| HMath.Error | Errors shared by the checked linear algebra APIs. |
| HMath.Numeric | Numeric representations and deterministic IEEE utilities. |
| HMath.Scalar | Scalar utilities. |
| HMath.Trigonometry | Radian-based checked trigonometry. |
| HMath.Units | Exact rational unit conversion and API-level dimensional safety. |
Browse functions in this area.
Algebra and number theory¶
| Module | Purpose |
|---|---|
| HMath.Algebra | Algebraic interfaces, exact law checks, checked modular rings, and finite extension fields GF(p^n). |
| HMath.Algorithms | Reference numerical search and ordering algorithms. |
| HMath.Combinatorics | Exact combinatorics. |
| HMath.Complex | Checked finite complex arithmetic over Data.Complex. |
| HMath.NumberTheory | Exact integer algorithms. |
| HMath.Polynomial | Univariate polynomials with ascending coefficients: [a0,a1,...] means a0+a1*x+.... |
| HMath.Special | Real special functions with checked domains. |
Browse functions in this area.
Linear algebra¶
| Module | Purpose |
|---|---|
| HMath.Backend | Checked dense CPU kernels with explicit, garbage-collected provider handles. |
| HMath.Linear | List-based vector operations. |
| HMath.Matrix | Dense matrices with finite, row-major storage and zero-based indices. |
| HMath.Matrix.Advanced | Matrix constructors, products, spaces, and matrix functions. |
| HMath.Matrix.Decomposition | Pure reference decompositions with explicit shape and tolerance contracts. |
| HMath.Matrix.Iterative | Bounded reference iterative solvers for dense real matrices. |
| HMath.Matrix.LAPACK | Double-precision optional, dynamically loaded LAPACKE spectral routines. |
| HMath.Matrix.LU | Dense real LU factorization with partial row pivoting. |
| HMath.Matrix.QR | Column-pivoted Householder QR. |
| HMath.Sparse | Sparse matrices use canonical sorted coordinates, coalesced duplicates and no explicit zeros. |
| HMath.Sparse.Spectral | Matrix-free sparse power algorithms. |
| HMath.Vector | Immutable dynamically sized and type-indexed vectors. |
Browse functions in this area.
Calculus and differential equations¶
| Module | Purpose |
|---|---|
| HMath.Calculus | Checked, finite-difference differentiation and numerical quadrature for Double callbacks. |
| HMath.Interpolation | Checked reference interpolation and approximation. |
| HMath.ODE | Checked real ODE/DAE integration. |
| HMath.PDE | Structured-grid reference PDEs in one, two or three spatial dimensions. |
| HMath.Root | Checked Double root solvers. |
Browse functions in this area.
Optimization and differentiation¶
| Module | Purpose |
|---|---|
| HMath.Autodiff | Pure CPU automatic differentiation. |
| HMath.Optimization.Common | Shared checked Double objective contracts. |
| HMath.Optimization.Constrained | Dense bounded reference constrained optimization. |
| HMath.Optimization.FirstOrder | Explicit optimizer state for deterministic gradients, SGD and minibatches. |
| HMath.Optimization.Global | Seeded bounded CPU global search. |
| HMath.Optimization.Local | Bounded CPU reference local solvers. |
Browse functions in this area.
Statistics and time series¶
| Module | Purpose |
|---|---|
| HMath.Probability | Checked probability models. |
| HMath.Random | Explicit, immutable random streams. |
| HMath.Statistics | Public types and operations. |
| HMath.Statistics.Advanced | Finite-data checked statistics. |
| HMath.TimeSeries | Timestamped observations, bounded CPU forecasting, decomposition and diagnostics. |
| HMath.TimeSeries.Core | Timestamped finite observations. |
| HMath.TimeSeries.Diagnostics | Explicit-lag stationarity statistics, bounded change-point/warping reference algorithms, and forecast diagnostics. |
| HMath.TimeSeries.Models | Bounded Double forecasting models. |
Browse functions in this area.
Machine learning¶
| Module | Purpose |
|---|---|
| HMath.DeepLearning.Core | Checked Double activations, losses, and real-coordinate reverse rules. |
| HMath.DeepLearning.Layers | Row-major CPU layers. |
| HMath.DeepLearning.Metrics | Classification metrics. |
| HMath.DeepLearning.Precision | Explicit INT8 quantization and software FP16/BF16 matrix multiplication. |
| HMath.MachineLearning | Reproducible dense CPU estimators, preprocessing, clustering, and manifold methods. |
| HMath.MachineLearning.Clustering | Dense, finite-budget clustering. |
| HMath.MachineLearning.Decomposition | Dense decomposition and manifold reference algorithms. |
| HMath.MachineLearning.Internal | Shared, deliberately small dense reference kernels for the ML estimators. |
| HMath.MachineLearning.Neighbors | Exact branch-and-bound KD/ball trees and budgeted approximate search. |
| HMath.MachineLearning.Preprocessing | Fitted preprocessing and index-based splits. |
| HMath.MachineLearning.Regression | Dense reference estimators. |
Browse functions in this area.
Signals and transforms¶
| Module | Purpose |
|---|---|
| HMath.Fourier | CPU reference Fourier transforms. |
| HMath.Signal | CPU reference DSP. |
Browse functions in this area.
Geometry and images¶
| Module | Purpose |
|---|---|
| HMath.Geometry | Checked Cartesian geometry and bounded CPU reference algorithms. |
| HMath.Geometry.Collision | Bounded two-dimensional convex collision reference algorithms. |
| HMath.Geometry.Internal | Shared finite Euclidean geometry. |
| HMath.Geometry.Polygon | Planar hulls, polygon measurements and Boolean arrangements. |
| HMath.Geometry.Primitives | Checked distances, containment, intersections and primitive signed distance functions. |
| HMath.Geometry.Spatial | Immutable point-cloud spatial indexes. |
| HMath.Geometry.Transform | Column-vector homogeneous transforms. |
| HMath.Geometry.Triangulation | Deterministic Bowyer-Watson Delaunay triangulation (at most 256 unique points), edge-flip constrained Delaunay triangulation, polygon ear clipping, and bounded Voronoi cells. |
| HMath.Image | Finite ND CPU images and bounded reference color, filtering, resampling, histogram, topology, and measurement operations. |
| HMath.Image.Color | Three-channel color conversion. sRGB uses the IEC piecewise transfer; XYZ is D65 with Y=1 for reference white; Lab uses that same D65 white (no implicit chromatic adaptation). |
| HMath.Image.Core | Finite CPU images with row-major spatial axes and interleaved channels (last axis). |
| HMath.Image.Filter | Direct ND reference filtering and 2D edge detection. |
| HMath.Image.Histogram | Unit-range, per-channel histograms, equalization, thresholds, and CLAHE. |
| HMath.Image.Measure | Image measurements use caller-declared intensity ranges and explicit local windows. |
| HMath.Image.Spatial | 2D resampling/warps, ND binary topology, and exact bounded distance queries. |
| HMath.Quaternion | Finite Hamilton quaternions in scalar-first (w,x,y,z) order. |
| HMath.Rotation | SO(3), SE(3), and rigid dual quaternions. |
Browse functions in this area.
Graphs and symbolic mathematics¶
| Module | Purpose |
|---|---|
| HMath.DataStructure | Persistent finite range, queue, heap and streaming structures. |
| HMath.Discrete | Finite-width bits, relations and propositional logic. |
| HMath.Expression | A pure, bounded real expression language shared with HMath.Symbolic. |
| HMath.Graph.Analysis | Finite graph analysis. |
| HMath.Graph.Core | Checked finite labeled multigraphs. |
| HMath.Graph.Flow | Exact integral network flow and assignment. |
| HMath.Graph.Paths | Checked graph paths. |
| HMath.Symbolic | Bounded symbolic real algebra over the common Expr language. |
Browse functions in this area.
Tensors and interchange¶
| Module | Purpose |
|---|---|
| HMath.Interchange | Checked fixed-width numerical serialization and array exchange. |
| HMath.Interchange.Array | Fixed-width, typed array interchange. |
| HMath.Interchange.Binary | HMath array wire format version 1. |
| HMath.Interchange.Compression | Optional zlib codecs with an explicit hard decompression budget. |
| HMath.Interchange.IO | Bounded strict file codecs, fixed-chunk raw streaming, and read-only mapped arrays. |
| HMath.Interchange.Numpy | NPY v1v2v3 and NPZ (ZIP32 directory, stored or raw-DEFLATE members). |
| HMath.Interchange.Text | Bounded ASCII numeric formats. |
| HMath.Tensor | CPU tensors with immutable boxed backing arrays and shared, zero-copy strided views. |
| HMath.Tensor.Mutable | Pinned CPU storage with shared mutable views. |