Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

[QuantumErrorCorrection] Add QEC Tutorial as referred in Issue #412. #418

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions tutorials/QuantumErrorCorrection/QuantumErrorCorrection.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.Quantum.Sdk/0.12.20070124">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PlatformTarget>x64</PlatformTarget>
<RootNamespace>Quantum.Kata.QuantumErrorCorrection</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Quantum.Xunit" Version="0.12.20070124" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit" Version="2.3.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.3.1" />
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.1" />
</ItemGroup>

<ItemGroup>
<None Include="README.md" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\utilities\Common\Common.csproj" />
</ItemGroup>
</Project>
574 changes: 574 additions & 0 deletions tutorials/QuantumErrorCorrection/QuantumErrorCorrection.ipynb

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions tutorials/QuantumErrorCorrection/QuantumErrorCorrection.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "QuantumErrorCorrection", "QuantumErrorCorrection.csproj", "{B4477C91-FBD6-4DCE-8B4C-1A5E48669790}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Common", "..\..\utilities\Common\Common.csproj", "{BC099DCB-6526-49CF-8638-0132C9C5AE89}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B4477C91-FBD6-4DCE-8B4C-1A5E48669790}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B4477C91-FBD6-4DCE-8B4C-1A5E48669790}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B4477C91-FBD6-4DCE-8B4C-1A5E48669790}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B4477C91-FBD6-4DCE-8B4C-1A5E48669790}.Release|Any CPU.Build.0 = Release|Any CPU
{BC099DCB-6526-49CF-8638-0132C9C5AE89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BC099DCB-6526-49CF-8638-0132C9C5AE89}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BC099DCB-6526-49CF-8638-0132C9C5AE89}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BC099DCB-6526-49CF-8638-0132C9C5AE89}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {F23513ED-2103-49D7-9F64-7BA3199FC689}
EndGlobalSection
EndGlobal
10 changes: 10 additions & 0 deletions tutorials/QuantumErrorCorrection/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Welcome!

This folder contains a Notebook tutorial on Quantum Error Correction -
an application of quantum computing that is used in quantum computing to protect quantum information from errors due to decoherence and other quantum noise.

You can run the tutorial online [here](https://mybinder.org/v2/gh/Microsoft/QuantumKatas/master?filepath=tutorials/QuantumErrorCorrection%2FQuantumErrorCorrection.ipynb). Alternatively, you can install Jupyter and Q# on your machine, as described [here](https://docs.microsoft.com/quantum/install-guide/jupyter), and run the tutorial locally by navigating to this folder and starting the notebook from command line using the following command:

jupyter notebook QuantumErrorCorrection.ipynb

The Q# project in this folder contains the back-end of the tutorial and is not designed for direct use.
25 changes: 25 additions & 0 deletions tutorials/QuantumErrorCorrection/ReferenceImplementation.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

//////////////////////////////////////////////////////////////////////
// This file contains reference solutions to all tasks.
// You should not modify anything in this file.
// We recommend that you try to solve the tasks yourself first,
// but feel free to look up the solution if you get stuck.
//////////////////////////////////////////////////////////////////////

namespace Quantum.Kata.QuantumErrorCorrection {

open Microsoft.Quantum.Arrays;
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Measurement;
open Microsoft.Quantum.Math;


// Exercise 1.
operation Untitled_Reference () : Int {
return 0;
}
}
20 changes: 20 additions & 0 deletions tutorials/QuantumErrorCorrection/Tasks.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

//////////////////////////////////////////////////////////////////
// This file is a back end for the tasks in Deutsch-Jozsa algorithm tutorial.
// We strongly recommend to use the Notebook version of the tutorial
// to enjoy the full experience.
//////////////////////////////////////////////////////////////////

namespace Quantum.Kata.QuantumErrorCorrection {

open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Canon;

// Exercise 1.
operation Untitled() : Int {
return 0;
}
}
45 changes: 45 additions & 0 deletions tutorials/QuantumErrorCorrection/TestSuiteRunner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

//////////////////////////////////////////////////////////////////////
// This file contains parts of the testing harness.
// You should not modify anything in this file.
// The tasks themselves can be found in Tasks.qs file.
//////////////////////////////////////////////////////////////////////

using System.Diagnostics;

using Microsoft.Quantum.Katas;
using Microsoft.Quantum.Simulation.XUnit;

using Xunit.Abstractions;


namespace Quantum.Kata.QuantumErrorCorrection
{
public class TestSuiteRunner
{
private readonly ITestOutputHelper output;

public TestSuiteRunner(ITestOutputHelper output)
{
this.output = output;
}

/// <summary>
/// This driver will run all Q# tests (operations named "...Test")
/// that belong to namespace Quantum.Kata.QuantumErrorCorrection.
/// </summary>
[OperationDriver(TestNamespace = "Quantum.Kata.QuantumErrorCorrection")]
public void TestTarget(TestOperation op)
{
using (var sim = new CounterSimulator())
{
// OnLog defines action(s) performed when Q# test calls function Message
sim.OnLog += (msg) => { output.WriteLine(msg); };
sim.OnLog += (msg) => { Debug.WriteLine(msg); };
op.TestOperationRunner(sim);
}
}
}
}
23 changes: 23 additions & 0 deletions tutorials/QuantumErrorCorrection/Tests.qs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

//////////////////////////////////////////////////////////////////////
// This file contains testing harness for all tasks.
// You should not modify anything in this file.
//////////////////////////////////////////////////////////////////////

namespace Quantum.Kata.QuantumErrorCorrection {

open Microsoft.Quantum.Intrinsic;
open Microsoft.Quantum.Diagnostics;
open Microsoft.Quantum.Convert;
open Microsoft.Quantum.Math;
open Microsoft.Quantum.Arrays;
open Quantum.Kata.Utils;


// Exercise 1.
operation T1_Untitiled () : Unit {
Message("Testing...");
}
}