@Override
  public Matrix apply(DenseMatrix a, DenseMatrix b) {
    Matrix result = a.blank();

    for (int i = 0; i < a.rows(); i++) {
      for (int j = 0; j < a.columns(); j++) {
        result.set(i, j, a.get(i, j) - b.get(i, j));
      }
    }

    return result;
  }
  @Override
  public Matrix applySimple(SparseMatrix a, DenseMatrix b) {
    Matrix result = b.multiply(-1.0);
    MatrixIterator it = a.nonZeroIterator();

    while (it.hasNext()) {
      double x = it.next();
      int i = it.rowIndex();
      int j = it.columnIndex();
      result.set(i, j, result.get(i, j) + x);
    }

    return result;
  }