Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 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]));
 }