operator == method

  1. @override
bool operator ==(
  1. dynamic other
)
override

Equality check for each element in the matrix.

Implementation

@override
bool operator ==(dynamic other) {
  if (other is Vector) {
    other = other.toMatrix();
  }

  if (other is Matrix) {
    if (this.m == other.m && this.n == other.n) {
      for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) {
          if (!_isClose(this[i][j], other[i][j])) {
            return false;
          }
        }
      }
      return true;
    } else {
      return false;
    }
  } else {
    return false;
  }
}