Matrix class bugfix

This commit is contained in:
Filip Znachor 2022-10-04 22:35:37 +02:00
parent d45f041551
commit 45929eb414

View file

@ -29,7 +29,7 @@ export class Matrix {
}
add(other_matrix: Matrix) {
if(!(other_matrix.cols == this.cols && other_matrix.rows == this.cols)) throw Error("Other matrix has more or few rows or columns");
if(!(other_matrix.cols == this.cols && other_matrix.rows == this.rows)) throw Error("Other matrix has more or few rows or columns");
for(let i=0; i<this.matrix.length; i++) {
for(let j=0; j<this.matrix[i].length; j++) {
this.matrix[i][j] += other_matrix.matrix[i][j];