Multiplication of two matrix
function mat_multiply(a,b) { //Logic var p = a.length; var q = b.length; var r = b[0].length; c = Array(p).fill(0).map(x => Array(r).fill(0)); for(var i = 0; i < p; i++) { for(var j = 0; j < r; j++) { for(var k = 0; k < q; k++) { c[i][j] += (a[i][k] * b[k][j]) % R; } } } return c; }