Example #1
0
        public void Test(Instance instance)
        {
            var sim = new OracleCounterSimulator();

            var len   = instance.Kernel.Count;
            var saver = new List <IQArray <long> >();

            for (int i = 0; i < len * 4; ++i)
            {
                var watch = System.Diagnostics.Stopwatch.StartNew();
                var(vector, uf) = cs_helper.Run(sim, len, instance.ExtendedTransformation).Result;
                watch.Stop();
                long ticks = watch.ElapsedTicks;
                Console.WriteLine("n: " + len + " RunTime: " + ticks);

                Assert.Equal(1, sim.GetOperationCount(uf));
                saver.Add(vector);
            }

            var matrix = new BooleanMatrix(saver);
            var kernel = matrix.GetKernel();

            Assert.Equal(instance.Kernel.Contains(true) ? 2 : 1, kernel.Count);
            Assert.Contains(instance.Kernel, kernel);
        }
Example #2
0
        public void Test(Instance instance)
        {
            {
                var sim = new OracleCounterSimulator();

                var len   = instance.Kernel.Count;
                var saver = new List <IQArray <long> >();

                for (int i = 0; i < len * 4; ++i)
                {
                    var(vector, uf) = cs_helper.Run(sim, len, instance.ExtendedTransformation).Result;
                    Assert.Equal(1, sim.GetOperationCount(uf));
                    saver.Add(vector);
                }

                var matrix = new BooleanMatrix(saver);
                var kernel = matrix.GetKernel();


                Assert.Equal(instance.Kernel.Contains(true) ? 2 : 1, kernel.Count);
                Assert.Contains(instance.Kernel, kernel);
            }
            Stopwatch s = new Stopwatch();

            s.Start();
            for (int j = 0; j < 10; j++)
            {
                var sim = new OracleCounterSimulator();

                var len   = instance.Kernel.Count;
                var saver = new List <IQArray <long> >();

                for (int i = 0; i < len * 4; ++i)
                {
                    var(vector, uf) = cs_helper.Run(sim, len, instance.ExtendedTransformation).Result;
                    Assert.Equal(1, sim.GetOperationCount(uf));
                    saver.Add(vector);
                }

                var matrix = new BooleanMatrix(saver);
                var kernel = matrix.GetKernel();


                Assert.Equal(instance.Kernel.Contains(true) ? 2 : 1, kernel.Count);
                Assert.Contains(instance.Kernel, kernel);
            }
            s.Stop();
            Console.Write(instance.instance);
            Console.Write(",");
            Console.Write(instance.kernel.Count());
            Console.Write(",");
            Console.WriteLine(s.ElapsedMilliseconds);
        }
        public void Test(Instance instance)
        {
            var sim = new OracleCounterSimulator();

            var len   = instance.Kernel.Count;
            var saver = new List <IQArray <long> >();

            for (int i = 0; i < len * 4; ++i)
            {
                var(vector, uf) = cs_helper.Run(sim, len, instance.ExtendedTransformation).Result;
                Assert.Equal(1, sim.GetOperationCount(uf));
                saver.Add(vector);
            }

            var matrix = new BooleanMatrix(saver);
            var kernel = matrix.GetKernel();

            Assert.Equal(instance.Kernel.Contains(true) ? 2 : 1, kernel.Count);
            Assert.Contains(instance.Kernel, kernel);
        }