ndarray-js

Description

Welcome to the documentation of ndarray-js

ndarray-js is a reimplementation of numpy for javascript that aims to make the coding experience as similar to numpy as possible.

Interactive demo:

Errors:

Console output:

SVG outputs:

API Index

  • Global namespace: np
  • NDArray class: np.NDArray.

Browser usage

In html:

<script src="https://cdn.jsdelivr.net/npm/ndarray-js@latest/dist/index.js"></script>
<script>
a = np.arange(18).reshape(3, 2, 3);
console.log(a.tolist());
</script>

Or press F12 and play with the browser console directly.

Node usage

Installation:

npm install ndarray-js

Use in nodejs with require:

const { np } = require('ndarray-js');
a = np.arange(18).reshape(3, 2, 3);
console.log(a.tolist());

Use in nodejs with typescript (run with ts-node or compile with tsc):

import { np } from 'ndarray-js';
const a = np.arange(18).reshape(3, 2, 3);
console.log(a.tolist());

Use in Jupyter notebooks:

You need to install the ipykernel (the setup is a bit more complex).

Example notebook: https://github.com/caph1993/numpy-js/blob/main/notebooks/normal-scatter.ipynb

Index

Modules

Namespaces

Classes

Functions

Generated using TypeDoc