UNPKG

linear-algebra

Version:

Efficient, high-performance linear algebra library

54 lines (37 loc) 943 B
Matrix.prototype.NAME = function(op2) { var thisData = this.data, rows = this.rows, cols = this.cols, op2Data = op2.data, rows2 = op2.rows, cols2 = op2.cols; if (rows !== rows2 || cols !== cols2) { _throwSizeMismatchError('NAME', this, op2); } var row, col, result = new Array(rows); for (row=0; row<rows; ++row) { result[row] = new Array(cols); for (col=0; col<cols; ++col) { result[row][col] = 'EXPR'; } } return new Matrix(result); }; Matrix.prototype.NAME_ = function(op2) { var thisData = this.data, rows = this.rows, cols = this.cols, op2Data = op2.data, rows2 = op2.rows, cols2 = op2.cols; if (rows !== rows2 || cols !== cols2) { _throwSizeMismatchError('NAME_', this, op2); } var row, col; for (row=0; row<rows; ++row) { for (col=0; col<cols; ++col) { thisData[row][col] = 'EXPR'; } } return this; };