open-index/open-npm huggingface dataset:
npm package: @nippunsharma/linalg
Description: A package for linear algebra in the browser !!
Author: Nippun Sharma
Latest version: 0.1.0-beta.0

@webml/linalg is a linear algebra library for the browser based on [armadillo](https://gitlab.com/conradsnicta/armadillo-code).

@webml/linalg uses Web Assembly to run armadillo code (in C++) in the browser.

### Steps to install.
This library can be installed directly via npm:
```bash
npm install @webml/linalg
```

### Basic usage.
```typescript
import { Matrix } from "@webml/linalg";

async getMatrix() {
  const A: Matrix<number> = new Matrix<number>({ n_rows: 2, n_cols: 2 }, "float");
  await A.init();
  return A;
}

const A = await getMatrix();
A.funcFill((i, j) => i + j); // fill matrix A.
const B = A.t(); // transpose of A.

console.log(A.toString());
console.log(B.toString());
```

### Steps to build.
1. Clone github repo.
```bash
git clone --recurse-submodules https://github.com/NippunSharma/webml-linalg
```
2. Move to project dir.
```bash
cd webml-linalg
mkdir -p build
```
3. Build clapack object files first.
```bash
make clapack
```
4. Build `webml_linalg.wasm` binary along with `webml_linalg.js`.
```bash
make webml_linalg
```
5. Now, generate the `dist` dir.
```bash
npm run build
```

Alternatively, you can directly execute `npm run build` and it will
use the pre-existing binary file in `resources/`. However, if anything
is changed in `src/embind`, it is recommended to rebuild the binary.