forked from microsoft/Quantum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDriver.cs
26 lines (22 loc) · 912 Bytes
/
Driver.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Author: Mathias Soeken, EPFL (Mail: [email protected])
// Licensed under the MIT License.
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
namespace Microsoft.Quantum.Samples.ReversibleLogicSynthesis
{
class Driver
{
static void Main(string[] args)
{
var sim = new QuantumSimulator();
var perm = new long[] { 0, 2, 3, 5, 7, 1, 4, 6 };
var res = SimulatePermutation.Run(sim, new QArray<long>(perm)).Result;
System.Console.WriteLine($"Does circuit realize permutation: {res}");
for (var shift = 0; shift < perm.Length; ++shift)
{
var measured_shift = FindHiddenShift.Run(sim, new QArray<long>(perm), shift).Result;
System.Console.WriteLine($"Applied shift = {shift} Measured shift: {measured_shift}");
}
}
}
}