RosettaCodeData/Task/Matrix-multiplication/Jsish/matrix-multiplication.jsish

19 lines
444 B
Plaintext

/* Matrix multiplication, in Jsish */
require('Matrix');
if (Interp.conf('unitTest')) {
var a = new Matrix([[1,2],[3,4]]);
var b = new Matrix([[-3,-8,3],[-2,1,4]]);
; a;
; b;
; a.mult(b);
}
/*
=!EXPECTSTART!=
a ==> { height:2, mtx:[ [ 1, 2 ], [ 3, 4 ] ], width:2 }
b ==> { height:2, mtx:[ [ -3, -8, 3 ], [ -2, 1, 4 ] ], width:3 }
a.mult(b) ==> { height:2, mtx:[ [ -7, -6, 11 ], [ -17, -20, 25 ] ], width:3 }
=!EXPECTEND!=
*/