Skip to content
Square matrix multiply.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
scripts
.gitignore
LICENSE
README.md
index.js
package.json
test.js

README.md

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...

Something went wrong with that request. Please try again.