During my years on Python development, I\'ve always been amazed at how much much much faster things become if you manage to rewrite that code that loops though your ndarray and
Here is Google's TensorFlow.js (previously https://deeplearnjs.org), which does exactly that, and has built in capacities to train deep neural networks on GPUs using WebGL. You can also port TensorFlow models to it.
Don't be fooled into thinking this is only for deep learning. It is a fully fledged numerical computing platform with built-in GPU acceleration. It follows the eager "execute as you go" model, like NumPy (and Tensorflow Eager, and PyTorch, and others), not the "define then run" model like Tensorflow. As such, it will feel natural to use to anyone who has used NumPy before.
Here is the very informative Github repo:
https://github.com/tensorflow/tfjs-core (the old link https://github.com/PAIR-code/deeplearnjs now redirects there)
I started https://www.npmjs.com/package/@nexys/math-ts a very simple and light numerical typescript library/package
scijs's ndarray is also good. link
var mat = ndarray(new Float64Array([1, 0, 0, 1]), [2,2])
//Now:
//
// mat = 1 0
// 0 1
//