Esempio n. 1
0
        public QHadamard(IQBit bit) : base(bit.Probability, bit.State)
        {
            //Console.WriteLine($"Applying Hadamard gate to {this}");
            //var t = new Complex(Math.Sqrt(0.5), 0);


            //Probability = 1 / Math.Sqrt(2);

            //Console.WriteLine($"Applying Hadamard gate to {this}");

            //Console.WriteLine(coeff);
        }
Esempio n. 2
0
        public QNot(IQBit bit) : base(bit.Probability, bit.State)
        {
            Console.WriteLine($"Applying Quantum Not to {this}");

            /*
             * x = 1 |0>
             * not(x)
             * x = 1 |1>
             */
            if (State == 1)
            {
                State = 0;
            }
            else
            {
                State = 1;
            }
        }
Esempio n. 3
0
 private static void PrintState(IQBit bit)
 {
     Console.WriteLine("{Probability} |{State}>");
     Console.WriteLine(bit);
 }