Quantum Transformations – Implementation

The Driver file will have the following code to execute BayesianPhaseEstimation.

Code Snippet : Driver C# Example

using Microsoft.Quantum.Simulation.Simulators;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PhaseEstimation
{
    class Program
    {

        static void Main(string[] args)
        {


            var sim = new QuantumSimulator(throwOnReleasingQubitsNotInZeroState: true);

            const Double eigenphaseValue = 0.344;


            System.Console.WriteLine("Phase Estimation checking  Likelihood ");
            GetPhaseEstimationIteration.Run(sim).Wait();


            System.Console.WriteLine("Bayesian Phase Estimation w/ Explicit Grid:");
            var estimate = GetBayesianPhaseEstimation.Run(sim, eigenphaseValue).Result;
            System.Console.WriteLine($"Expected value {eigenphaseValue}, estimated value {estimate}.");


            

        }
    }
}

Run the following commands  to execute the project in Visual Studio Code:

^F5 

In the terminal, you can execute the build by running the command below.

dotnet run


The screenshot of the output is attached below:

Leave a comment