MathScript is a C++23 computer-algebra and numerical library with a console REPL. It implements dense and sparse linear algebra, special functions, statistics, ODE/PDE/FEM/CFD, optimisation, signal and image processing, number theory, graphs, geometry, topology, quantum primitives, control, finance, compression, and a small symbolic CAS — all against one set of conventions (Result<T> instead of exceptions, no external BLAS/LAPACK).
Executables: mathscriptc, mathscript-repl, mathscript-server. Optional Qt GUI, CUDA, MPI, and LLVM ORC JIT are CMake-gated.
| Document | Contents |
|---|---|
| User guide | Install, first REPL session, syntax, plotting, JIT |
| Architecture | Layout, modules, CMake options, tests, CI |
| API index | Public headers under include/ms/ and REPL bindings |
| Contributing | Build, test, coverage, fuzz, plugin, packaging |
| Performance | Benchmarks, baselines, known complexity trade-offs |
| Release | 1.0.0 tag criteria and remaining gates |
| 1.0 scope | Stubs and post-1.0 deferrals (decided, not remaining) |
| Unsafe surface | Approved MS_UNSAFE sites |
| Wave history | How the library was built, wave by wave |
The surface is a numerical library: linear algebra, FFT, statistics, solvers, optimisation, signal/image processing, number theory, graphs, geometry, topology, quantum primitives, control, and finance. Implementations share std::vector coefficient polynomials, Result<T> error handling, and defensive checks on malformed input.
Two properties of the tree:
- In-tree BLAS/LAPACK.
linalgowns LU/QR/SVD/eig/Cholesky and LAPACK-style kernels (dorgbr,dlartg,dbdsqr, …). There is no Eigen or OpenBLAS dependency for the default path. - Restricted C++ subset. A Clang plugin can enforce twenty compile-time rules (no raw
new, nothrow, no C-style casts, …). Production code returnsResult<T>.
Static libraries under src/ (35 libraries, plus exe / gui / plugin):
| Group | Modules |
|---|---|
| Core and dispatch | core, runtime, linalg, simd, cuda, distributed |
| Numerical methods | fft, ode, pde, fem, cfd, poly, optim, special, signal |
| Statistics and ML | stats, prob, ml, info |
| Applied | finance, control, graph, geo, diffgeo, topo, quantum, cplx, tensorops, numthy, combo, bignum, compress, image, crypto |
| Symbolic and REPL | symbolic, interp |
| Frameworks | frameworks (axiom, cellai, cypha, gria, izaac) |
| Helpers | domain |
CPU BLAS/LAPACK kernels live in linalg and are declared in include/ms/cpu/blas.hpp and include/ms/cpu/lapack.hpp.
- Version: CMake project version 1.0.0. The
v1.0.0git tag is not cut; remaining gates are indocs/RELEASE.md. - Tests: 816 CTest suites, 100% passed on Windows MSVC Release (CUDA off, ~36 s at
-j 32). Tests live undertests/{unit,numerical,integration,performance}/<domain>/. CI enforces 90% line coverage. REPL matrix calls dispatch through a name-keyed handler registry (src/interp/matrix_calls/<domain>/). - Benchmarks: 28 Google Benchmark targets passed locally with
--benchmark_min_time=0.001s. CI regression uses 10% tolerance vslinux-gcc13.json. - CI: Windows MSVC and Linux GCC 13; coverage; libFuzzer smoke (7 targets); AddressSanitizer + UBSan; 28-bench regression (10% tolerance); Clang plugin; vendor checksums; optional JIT and plugin jobs.
Windows (single tree build-msvc):
.\build.ps1
ctest --test-dir build-msvc --output-on-failure
.\build-msvc\bin\mathscript-repl.exeLinux:
cmake -S . -B build -G Ninja \
-DCMAKE_C_COMPILER=gcc-13 -DCMAKE_CXX_COMPILER=g++-13 \
-DCMAKE_BUILD_TYPE=Release \
-DMS_BUILD_TESTS=ON -DMS_ENABLE_CUDA=OFF -DMS_ENABLE_AVX512=OFF
cmake --build build
ctest --test-dir build --output-on-failure
./build/bin/mathscript-replOptional: .\build.ps1 -Benchmark (same build-msvc tree, MS_BUILD_BENCHMARKS=ON). Full options: docs/CONTRIBUTING.md.