0.0.1 • Published 5 years ago
matrix-k v0.0.1
matrix-k
Fast Matrix library for Java Script
Benchmarks
Some Matrix multiplication benchmarks using Benchmark.js:
2x2 | 3x3 | 4x4 | 16x16 | 32x32 | 512x512 | 1024x1024 | |
---|---|---|---|---|---|---|---|
Matrix-K | 24,624 | 21,900 | 15,394 | 1,799 | 265 | 0.08 | 0.10 |
ml-Matrix | 8,606 | 6,205 | 4,112 | 1,003 | 217 | 0.08 | 0.09 |
Math.js | 5,560 | 3,830 | 2,913 | 146 | 20 | timeout | timeout |
number of operations per second obtained from chunks of 100 multiplications of squared nxn matrices
How to install
Run the command:
$ npm install matrix-k
How to use
const { Matrix } = require('matrix-k');
const A = new Matrix([[1, 2, 3], [4, 5, 6]]);
const B = new Matrix([[2, 1], [2, 0]]);
console.log(A.multiply(B));
shold print out:
How to run the benchmarks
The benchmark code is here. Run:
node benchmarks/multiplication.benchmark.js 10 4 10 5
for benchmark chunks of 10 4x10
by 10x5
matrix multiplications. Use --max-old-space-size=4096
when running huge matrices.
0.0.1
5 years ago