public bool Equals(Matrix m, double tol) { if (Rows != m.Rows || Cols != m.Cols) return false; for (int i = 0; i < Rows; i++) for (int j = 0; j < Cols; j++) if (System.Math.Abs(this[i, j] - m[i, j]) > tol) return false; return true; }