operator + method

Matrix2d operator +(
  1. dynamic other
)

Implementation

Matrix2d operator +(dynamic other) {
  if (other is num) {
    return Matrix2d(
        _rows,
        _cols,
        ValueVector(List.generate(_cols * _rows, (int index) {
          return data!.values[index] + other;
        })));
  } else {
    if (other is Matrix2d) {
      return Matrix2d(
          _rows,
          _cols,
          ValueVector(List.generate(_cols * _rows, (int index) {
            return data!.values[index] + other.data!.values[index];
          })));
    } else {
      throw UnimplementedError(
          "Operation + not supported for: ${other.runtimeType}");
    }
  }
}