operator + method

Matrix operator +(
  1. Matrix other
)

Implementation

Matrix operator +(Matrix other) {
  assert(this.nrows == other.nrows && this.ncols == other.ncols,
      "Matrix dimensions mismatch");

  final List<Vector> rowsResult = <Vector>[];
  for (int i = 0; i < nrows; i++) {
    rowsResult.add(this[i] + other[i]);
  }

  return Matrix.fromRows(rowsResult);
}