compare method

bool compare(
  1. Matrix<T> other, {
  2. bool equals(
    1. T a,
    2. T b
    )?,
})

Compares this Matrix and with other.

Implementation

bool compare(Matrix<T> other, {bool Function(T a, T b)? equals}) {
  if (equals == null && identical(this, other)) {
    return true;
  }
  if (rowCount != other.rowCount || colCount != other.colCount) {
    return false;
  }
  equals ??= dataType.equality.isEqual;
  for (var r = 0; r < rowCount; r++) {
    for (var c = 0; c < colCount; c++) {
      if (!equals(getUnchecked(r, c), other.getUnchecked(r, c))) {
        return false;
      }
    }
  }
  return true;
}