square-matrix-multiply

Square matrix multiply

npm install square-matrix-multiply
8 downloads in the last week
16 downloads in the last month

square-matrix-multiply

Stability: 1 - Experimental

Square matrix multiply.

Usage

var squareMatrixMultiply = require('square-matrix-multiply');
var matrixA = [[a, b], [c, d]];
var matrixB = [[e, f], [g, h]];
...
var matrixC = squareMatrixMultiply(matrixA, matrixB, 'strassen' /*algorithm selector (default: naive)*/);

Algorithms

Naive

Time complexity: O(n^3)

Strassen

Time complexity: O(n^2.81)

Strassen algorithm implementation only accepts square matrices the size of a power of 2. For example: 1x1, 2x2, 4x4, 16x16, 32x32, etc...

npm loves you