public bool Equals(State state) { if (this.Vector.ColumnCount != state.Vector.ColumnCount) { return(false); } for (int i = 0; i < this.Vector.ColumnCount; i++) { if (!Stuff.AlmostEquals(this.Vector[0, i], state.Vector[0, i])) { return(false); } } return(true); }
public bool Equals(Gate gate) { if (this.NbEntries != gate.NbEntries) { return(false); } for (int i = 0; i < this.Matrix.RowCount; i++) { for (int j = 0; j < this.Matrix.ColumnCount; j++) { if (!Stuff.AlmostEquals(this.Matrix[i, j], gate.Matrix[i, j])) { return(false); } } } return(true); }
public bool Equals(Qubit qubit) { return(Stuff.AlmostEquals(this.vector[0, 0], qubit.vector[0, 0]) && Stuff.AlmostEquals(this.vector[0, 1], qubit.vector[0, 1])); }