MCPcopy Index your code
hub / github.com/darkreader/darkreader / multiplyMatrices

Function multiplyMatrices

src/utils/math.ts:28–41  ·  view source on GitHub ↗
(m1: Matrix5x5, m2: Matrix5x5 | Matrix5x1)

Source from the content-addressed store, hash-verified

26
27// Note: the caller is responsible for ensuring that matrix dimensions make sense
28export function multiplyMatrices<M extends Matrix>(m1: Matrix5x5, m2: Matrix5x5 | Matrix5x1): M {
29 const result: number[][] = [];
30 for (let i = 0, len = m1.length; i < len; i++) {
31 result[i] = [];
32 for (let j = 0, len2 = m2[0].length; j < len2; j++) {
33 let sum = 0;
34 for (let k = 0, len3 = m1[0].length; k < len3; k++) {
35 sum += m1[i][k] * m2[k][j];
36 }
37 result[i][j] = sum;
38 }
39 }
40 return result as M;
41}

Callers 3

createFilterMatrixFunction · 0.90
applyColorMatrixFunction · 0.90
math.tests.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected