lmfit.js
JavaScript/WebAssembly (emscripten) port of lmfit (lmcurve) library:
"a self-contained C library for Levenberg-Marquardt least-squares minimization and curve fitting" (https://jugit.fz-juelich.de/mlz/lmfit)
build & test
source {path to emsdk}/emsdk_env.sh
npm install
npm run dist
npm run test
usage
There is a browser (lm.js - WebWorker) and a node (lm.node.js + wasm file) version in the dist folder. The browser version does not require a wasm file since it is all bundled.
Read about the available options at src/lm.js and https://jugit.fz-juelich.de/mlz/lmfit/-/blob/master/lib/lmstruct.h
web
; const options = verbose: true; const data = guess: 99 model: 'p[0] * Math.sqrt(x)' x y; const worker = ;worker { console if evdatainitialized worker };
node
const lmPromised = ; lmPromised;
missing features
- surface fitting as example for minimization with lmmin()
- nonlinear equations solving with lmmin()