try to write it this way
```scala
    Array.tabulate(a.rows, a.columns) { (i, j) =>
      diff.put(i, j,
        Math.min(Math.abs(a.get(i, j) - b.get(i, j)), Math.abs(a.get(i, j) + b.get(i, j))))
    }

```