MCPcopy
hub / github.com/trekhleb/javascript-algorithms / validate2D

Function validate2D

src/algorithms/math/matrix/Matrix.js:46–52  ·  view source on GitHub ↗
(m)

Source from the content-addressed store, hash-verified

44 * @throws {Error}
45 */
46const validate2D = (m) => {
47 validateType(m);
48 const aShape = shape(m);
49 if (aShape.length !== 2) {
50 throw new Error('Matrix is not of 2D shape');
51 }
52};
53
54/**
55 * Validates that matrices are of the same shape.

Callers 2

dotFunction · 0.85
tFunction · 0.85

Calls 2

validateTypeFunction · 0.85
shapeFunction · 0.85

Tested by

no test coverage detected