Example #1
0
        static void estimate(int action)
        {
            var estimator = new ResourcesEstimator();

            switch (action)
            {
            case 6:
                var res6 = MeasureQBit.Run(estimator, 1000, Result.Zero).Result;
                break;

            case 7:
                var res7 = FlipQBit.Run(estimator, 1000, Result.Zero).Result;
                break;

            case 8:
                var res8 = SuperposeQBit.Run(estimator, 1000, Result.Zero).Result;
                break;

            case 9:
                var res9 = EntangleQBits.Run(estimator, 1000, Result.Zero).Result;
                break;
            }

            System.Console.WriteLine(estimator.ToTSV());

            System.Console.WriteLine("");
            System.Console.WriteLine("CNOT: The count of CNOT(also known as the Controlled Pauli X gate) gates executed.");
            System.Console.WriteLine("QubitClifford: The count of any single qubit Clifford and Pauli gates executed.");
            System.Console.WriteLine("Measure: The count of any measurements executed.");
            System.Console.WriteLine("R: The count of any single qubit rotations executed, excluding T, Clifford and Pauli gates.");
            System.Console.WriteLine("T: The count of T gates and their conjugates, including the T gate, T_x = H.T.H, and T_y = Hy.T.Hy, executed.");
            System.Console.WriteLine("Depth: Depth of the quantum circuit executed by the Q# operation. By default, only T gates are counted in the depth, see depth counter for details.");
            System.Console.WriteLine("Width: Maximum number of qubits allocated during the execution of the Q# operation.");
            System.Console.WriteLine("BorrowedWidth: Maximum number of qubits borrowed inside the Q# operation.");
        }
Example #2
0
        static void runSuperposition(QuantumSimulator qsim, Result initial)
        {
            var res = SuperposeQBit.Run(qsim, 1000, initial).Result;

            var(numZeros, numOnes, agrees) = res;
            System.Console.WriteLine(
                $"Init:{initial,-4} 0s={numZeros,-4} 1s={numOnes,-4} agree={agrees,-4}");
        }