Math Operations¶
TinyMath — Numerical Computing for Edge Devices
From basic vector arithmetic to iterative eigenvalue solvers. Dual C/C++ API, covering everything from matrix multiplication to structural modal analysis.
Architecture¶
-
Vec — Vector Operations
tiny_vec· 1D vector arithmetic
add · sub · mul · div · sqrt · dot product -
Mat — C++ Matrix Class
tiny_matrix· RAII matrix class
Constructors · ROI · operator overloading
Decompositions · eigenvalues · solvers -
tiny_mat — C Matrix
tiny_mat· Pure C matrix operations
Element-wise ops · QR decomposition
Minimal footprint (~2 KB) -
Linalg — Basic Linear Algebra
tiny_linalg· add / sub / mul
transpose · norm · eye · fill · diag
Layer 1 — foundation for all upper layers -
Cfloat — Complex Numbers
tiny_cfloat· Complex type & arithmetic
add · sub · mul · div · abs · arg · log · sqrt
Layer 2 — required by QR eigenvalue -
Decomp — Matrix Decompositions
tiny_decomp· MGS QR · Householder QR
Layer 3 — core of ERA / SSI / least squares -
Eigen — Eigenvalues & Modal Analysis
tiny_eigen· Francis QR · 2×2 closed-form
tiny_modal· poles→freq/damping · MAC
Layer 4 — structural dynamics -
Iterative — Krylov Methods
tiny_iterative· Arnoldi · Lanczos · RSVD
Operator interface · Hankel / covariance ops
Layer 5 — large-scale sparse systems
Use Case Index¶
-
Basic matrix arithmetic
→ Linalg / Mat
-
QR decomposition / least squares
→ Decomp (MGS / HQR)
-
Eigenvalues / modal analysis
→ Eigen (Francis QR, MAC)
-
Complex arithmetic
→ Cfloat
-
Large sparse eigenvalue problems
→ Iterative (Arnoldi, Lanczos)
-
Full-featured C++ matrix class
→ Mat (tiny::Mat + decompositions + solvers)
Quick Start¶
#include "tiny_matrix.hpp"
// 3×3 matrix
tiny::Mat A(3, 3);
A(0,0) = 4; A(0,1) = 1; A(0,2) = 1;
A(1,0) = 1; A(1,1) = 3; A(1,2) = 2;
A(2,0) = 1; A(2,1) = 2; A(2,2) = 5;
// LU decomposition
auto lu = A.lu_decompose();
// Eigenvalue decomposition (auto-selects Jacobi / QR)
auto eig = A.eigendecompose();
// Solve linear system Ax = b
tiny::Mat b(3, 1);
b(0,0) = 6; b(1,0) = 9; b(2,0) = 12;
tiny::Mat x = A.solve(A, b);
Dependency Chain¶
Level 5: ITERATIVE ── Arnoldi / Lanczos / RSVD
Level 4: EIGEN ── Francis QR / modal analysis (MAC)
Level 3: DECOMP ── MGS QR / Householder QR
Level 2: CFLOAT ── Complex arithmetic
Level 1: LINALG ── Element-wise matrix ops (add/sub/mul/norm)
- Lower layers are independent; each can be used standalone
- VEC (vector ops) and MAT (C++ Mat class + C helpers) are independent modules
- C++ Mat class has built-in decomposition and eigenvalue solvers
Code Structure¶
include/ tiny_math.h · tiny_math_config.h · tiny_constants.h · tiny_error_type.h
vec/ vector operations
mat/ C++ tiny::Mat class + C tiny_mat + print helpers
linalg/ basic linear algebra
cfloat/ complex arithmetic
decomp/ QR decomposition (MGS · HQR)
eigen/ eigenvalues · modal analysis
iterative/ Krylov methods · operator interface
test/ self-test suite