@ml.wasm/linalg

Linear algebra accelerated by WebAssembly

Usage no npm install needed!

<script type="module">
  import mlWasmLinalg from 'https://cdn.skypack.dev/@ml.wasm/linalg';
</script>

README

📐 ml.wasm/linalg 📏

Linear Algebra powered by Web Assembly

This project is currently in alpha and missing some crucial features

docs | npm

Quick Start

Here, to demonstrate, we'll be using vite to scaffold a project:

npm init vite@latest  # choose a simple vanilla js project
npm i @ml.wasm/linalg

And add this to main.js:

import init, {
  initThreadPool,
  IntegersVector,
  FloatsVector,
  StringsVector,
  IntegersMatrix,
  FloatsMatrix,
  StringsMatrix,
} from '@ml.wasm/linalg';

(async () => {
  // This init function sets up everything you need to use this library
  await init();

  // This sets up the concurrency
  await initThreadPool(navigator.hardwareConcurrency);

  // All your code goes here...
})();

Note that you'll have to create a vite.config.js:

export default {
  server: {
    fs: {
      // Allow serving files from one level up to the project root
      allow: ['..']
    }
  }
}