public bool Equals(PauliTerm x) { // If parameter is null, return false. if (ReferenceEquals(x, null)) { return(false); } // Optimization for a common success case. if (ReferenceEquals(this, x)) { return(true); } // If run-time types are not exactly the same, return false. if (GetType() != x.GetType()) { return(false); } // Return true if the fields match. return(QubitIndices.SequenceEqual(x.QubitIndices) && TermType == x.TermType); }
bool IEquatable <PauliTerm> .Equals(PauliTerm other) => other.TermType == this.TermType && QubitIndices.SequenceEqual(other.QubitIndices);
/// <summary> /// Creates a copy of this instance. /// </summary> public PauliTerm Clone() => new PauliTerm(QubitIndices.ToArray().Clone <int>(), TermType);