async public Task ProblemU2_2() { int N = 2; string dumpPath = Modules.GetTempFilepath(); using var sim = new QuantumSimulator(); await QSharpCodingContestWinter2019Warmup.ProblemU2.Driver.Run(sim, N, dumpPath); DumpUnitaryParser parser = new DumpUnitaryParser(dumpPath, N); for (int i = 0; i < (1 << N); i++) { for (int j = 0; j < (1 << N); j++) { int a = i / 2; int b = j / 2; int c = a % 2 + b % 2; if (c % 2 == 0) { parser.GetCoefficient(i, j).Should().BeGreaterThan(Modules.EPS); } else { parser.GetCoefficient(i, j).Should().BeLessThan(Modules.EPS); } } } }
async public Task ProblemU3_2() { int N = 2; string dumpPath = Modules.GetTempFilepath(); using var sim = new QuantumSimulator(); await QSharpCodingContestWinter2019Warmup.ProblemU3.Driver.Run(sim, N, dumpPath); DumpUnitaryParser parser = new DumpUnitaryParser(dumpPath, N); for (int i = 0; i < (1 << N); i++) { for (int j = 0; j < (1 << N); j++) { bool top = i < (1 << (N - 1)); bool left = j < (1 << (N - 1)); if (top && left) { if (i + j == (1 << (N - 1)) - 1) { parser.GetCoefficient(i, j).Should().BeGreaterThan(Modules.EPS); } else { parser.GetCoefficient(i, j).Should().BeLessThan(Modules.EPS); } } else if (!top && !left) { parser.GetCoefficient(i, j).Should().BeGreaterThan(Modules.EPS); } else { parser.GetCoefficient(i, j).Should().BeLessThan(Modules.EPS); } } } }