An easy to use Web Assembly linear equation solver built with Rust
yarn add @flowcircuits/wasmles
import { LinearEquation } from "@flowcircuits/wasmles";
import wasmInit, { solveLinearEquations } from "@flowcircuits/wasmles/browser";
const linearEquations: LinearEquation[] = [
{ variables: { a: 2, b: 8, c: -1 }, constant: 6 },
{ variables: { a: 1, b: -4, c: 2 }, constant: -6 },
{ variables: { a: 4, b: 2, c: 1 }, constant: 10 },
];
wasmInit().then(() => {
const solutionMap = solveLinearEquations(linearEquations);
const solution = Object.fromEntries(solutionMap);
console.log(solution);
// {
// a: 6,
// b: -2,
// c: -10,
// }
});
import { LinearEquation } from "@flowcircuits/wasmles";
import { solveLinearEquations } from "@flowcircuits/wasmles/node";
const linearEquations: LinearEquation[] = [
{ variables: { a: 2, b: 8, c: -1 }, constant: 6 },
{ variables: { a: 1, b: -4, c: 2 }, constant: -6 },
{ variables: { a: 4, b: 2, c: 1 }, constant: 10 },
];
const solutionMap = solveLinearEquations(linearEquations);
const solution = Object.fromEntries(solutionMap);
console.log(solution);
// {
// a: 6,
// b: -2,
// c: -10,
// }
yarn build
yarn test