WebAssembly bindings exposing selected entry points of polyhedral_common to JavaScript. Built with Emscripten + embind.
The artifacts are vendored into the interactive Tools page on https://mathieudutsik.github.io/Tools.html.
src/ C++ files registering EMSCRIPTEN_BINDINGS(...)
build.sh Compile every src/*.cpp into dist/<name>.js + .wasm
dist/ Built artifacts. Committed so consumers don't need a
C++ toolchain to deploy the site.
The current module exposes one combined binary (polyhedral.{js,wasm})
holding every WASM entry point. Each entry registers via
emscripten::function(...) in src/polyhedral_bindings.cpp:
| JS function name | Polyhedral_common routine |
|---|---|
testCopositivity |
TestCopositivity |
testStrictCopositivity |
TestStrictCopositivity |
testCopositiveFactorization |
TestingAttemptStrictPositivity |
testShortestVectorsRealizability |
SHORT_TestRealizabilityShortestFamily |
shortestVectorsAutomorphismGroup |
SHORT_GetStabilizer |
gramCanonicalForm |
ComputeCanonicalForm |
Requires Emscripten + Boost + Eigen.
brew install emscripten boost eigen
./build.shBy default the script expects polyhedral_common to live at
../../GITmathieu/polyhedral_common. Override with:
POLYHEDRAL_COMMON=/path/to/polyhedral_common ./build.shThe script runs a node-based smoke test at the end. If it prints
smoke test OK, the artifacts in dist/ are ready to be vendored.
In the static-site repo (mathieudutsik.github.io):
./pull-wasm.sh # copies dist/polyhedral.{js,wasm} into wasm/then commit the result. The page loads /wasm/polyhedral.js and calls:
const m = await createPolyhedralModule();
const r = m.testCopositivity(3, ["1","0","0","0","1","0","0","0","1"]);
// r.isCopositive : bool
// r.nature : string
// r.witness : VectorString (use r.witness.size() / r.witness.get(i))- Add the entry-point function inside
src/polyhedral_bindings.cppand register it in theEMSCRIPTEN_BINDINGS(polyhedral_module)block. - Extend the node smoke test at the bottom of
build.shto exercise it. - Bump the table above and (if the binding needs a new include path)
the
INCLUDESarray inbuild.sh.