コード例 #1
0
        public void TeleportGateCountTest()
        {
            RunTest(sim =>
            {
                TeleportTests.Run(sim).Wait();

                var totNrMs        = sim.GetMetric <TeleportTests>(PrimitiveOperationsGroupsNames.Measure);
                var totNrRs        = sim.GetMetric <TeleportTests>(PrimitiveOperationsGroupsNames.R);
                var totNrTs        = sim.GetMetric <TeleportTests>(PrimitiveOperationsGroupsNames.T);
                var totNrCliffords = sim.GetMetric <TeleportTests>(PrimitiveOperationsGroupsNames.QubitClifford);
                var totNrCNOTs     = sim.GetMetric <TeleportTests>(PrimitiveOperationsGroupsNames.CNOT);

                var MsPerTest    = sim.GetMetric <TeleportAndReset, TeleportTests>(PrimitiveOperationsGroupsNames.Measure);
                var TsPerTest    = sim.GetMetric <TeleportAndReset, TeleportTests>(PrimitiveOperationsGroupsNames.T);
                var CNOTsPerTest = sim.GetMetric <TeleportAndReset, TeleportTests>(PrimitiveOperationsGroupsNames.CNOT);

                var summary = sim.ToCSV()[MetricsCountersNames.primitiveOperationsCounter];

                output.WriteLine("\nGate counts for all tests:");
                output.WriteLine($"Total number of measurements for all tests: {totNrMs}");
                output.WriteLine($"Total number of rotation gates for all tests: {totNrRs}");
                output.WriteLine($"Total number of T gates for all tests: {totNrTs}");
                output.WriteLine($"Total number of Clifford gates for all tests: {totNrCliffords}");
                output.WriteLine($"Total number of CNOT gates for all tests: {totNrCNOTs}");

                output.WriteLine("\nGate counts for a single test:");
                output.WriteLine($"Number of measurements within a single test: {MsPerTest}");
                output.WriteLine($"Number of T gates within a single test: {TsPerTest}");
                output.WriteLine($"Number of CNOT gates within a single test: {CNOTsPerTest}");

                output.WriteLine("\nSummary in CSV format:");
                output.WriteLine(summary);
            });
        }
コード例 #2
0
 public void TeleportTest()
 {
     RunTest(sim =>
     {
         TeleportTests.Run(sim).Wait();
         output.WriteLine($"All teleport tests passed.");
     });
 }