Skip to content

Commit

Permalink
Reorganize samples to being onboarding to https://docs.microsoft.com/…
Browse files Browse the repository at this point in the history
…samples/. (microsoft#235)

* Samples folder to lowercase.

* More work towards extracting getting started samples.

* Move numerics samples into samples.

* Moved teleportation sample to getting-started folder.

* Moved over rest of getting-started samples.

* Moved chemistry samples into samples folder.

* Finished moving interoperability and algorithm samples into subfolders.

* Solution for algorithms sample.

* Fixed paths in sampletests.csproj.

* Fix measurement tests.

* Move phase estimation to characterization samples.

* Add solution and Python host for Bayesian PE.

* Slight README fixes.

* Split out most samples into categories.

* Finished splitting samples into categories.

* Fixing tests.sln paths.

* Fixed some csproj paths.

* Moved schema back from accidental move.

* Fixed path to integral data in test.ps1.

* Fix paths in test.ps1.

* Fix case sensitivity for FSharp driver path.

* Fix and add missing solutions.

* Fixed path to RLS sample.

* Added rest of READMEs.

* Addressing @natke feedback.
  • Loading branch information
Chris Granade authored Oct 10, 2019
1 parent 3115897 commit 67f75e8
Show file tree
Hide file tree
Showing 483 changed files with 1,178 additions and 882 deletions.
13 changes: 5 additions & 8 deletions Build/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ function Test-One {
}

function Validate-Integrals {

if (($Env:AGENT_OS -ne $null) -and ($Env:AGENT_OS.StartsWith("Win"))) {
if (($null -ne $Env:AGENT_OS) -and ($Env:AGENT_OS.StartsWith("Win"))) {
Push-Location (Join-Path $PSScriptRoot "..\Chemistry\Schema\")
python validator.py ../IntegralData/**/*.yaml broombridge-0.1.schema.json
python validator.py $PSScriptRoot/Samples/chemistry/IntegralData/**/*.yaml broombridge-0.1.schema.json

if ($LastExitCode -ne 0) {
Write-Host "##vso[task.logissue type=error;]Failed to validate IntegralData"
Expand All @@ -41,12 +40,10 @@ function Validate-Integrals {

Validate-Integrals

Test-One '../Samples/src/UnitTesting'

Test-One '../Samples/tests/SampleTests'
Test-One '../samples/tests/sample-tests'
Test-One '../samples/diagnostics/unit-testing'

if (-not $all_ok)
{
if (-not $all_ok) {
throw "At least one project failed to compile. Check the logs."
}

106 changes: 35 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,47 @@
# Microsoft Quantum Development Kit Samples #

[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/Microsoft/Quantum/master)

These samples demonstrate the use of the Quantum Development Kit for a variety of different quantum computing tasks.
Most samples are provided as a Visual Studio 2017 C# or F# project under the [`QsharpSamples.sln`](./Samples/QsharpSamples.sln) solution.

Each sample is self-contained in a folder. Most of the samples consist of a Q# source file with detailed comments explaining the sample and a short classical program (either `Program.cs` (C#), `Program.fs` (F#), or `host.py` (Python)) that calls into the Q# operations and functions.
There are some samples that are written as an interactive Jupyter notebook thus require no classical host.
Each sample is self-contained in a folder, and demonstrates how to use Q# to develop quantum applications.

A small number of the samples have additional installation requirements beyond those for the rest of the Quantum Development Kit.
These are noted in the README.md files for each sample, along with complete installation instructions.

You can find instructions on how to install the Quantum Development Kit in [our online documentation](https://docs.microsoft.com/en-us/quantum/install-guide/), which also includes
an introduction to [quantum programming concepts](https://docs.microsoft.com/en-us/quantum/concepts/). A [Docker](https://docs.docker.com/install/) image definition is also provided for your convenience, see below
for instructions on how to build and use it.

The samples are broken down into four broad categories, each of which is described below.

## 0. Introductory Samples ##

- **[TeleportationSample](./Samples/src/Teleportation/)**:
This sample documents how to write quantum programs with Q#, C#, and Visual Studio, using the [development techniques](https://docs.microsoft.com/quantum/quantum-devguide-1-intro) covered in the main documentation.
It also shows how to simulate the same algorithms from Python and Jupyter.
- **[Measurement](./Samples/src/Measurement)**:
This sample goes into more detail about how single- and multiple-qubit measurements are represented in Q#, and how to measure in interesting bases such as the Bell basis.
- **[SimpleAlgorithms](./Samples/src/SimpleAlgorithms)**:
This sample covers several different basic quantum algorithms, and how each can be written in Q#.
- **[IntroToIQSharp](./Samples/src/IntroToIQSharp)**:
This samples explains how to create interactive notebooks using Jupyter and IQ#.

## 1. Algorithm Samples ##

- **[DatabaseSearch](./Samples/src/DatabaseSearch)**:
This sample demonstrates how to use Grover's algorithm to efficiently search a database represented as a quantum register.
- **[IntegerFactorization](./Samples/src/IntegerFactorization)**:
This sample demonstrates how to use Shor's algorithm to efficiently factor integers.
- **[ReversibleLogicSynthesis](./Samples/src/ReversibleLogicSynthesis)**:
This sample demonstrates how to use reversible logic synthesis to solve the hidden shift problem.
- **[CHSHGame](./Samples/src/CHSHGame)**:
This sample demonstrates a famous nonlocal game which proves that no theory of local hidden variables can ever reproduce all the predictions of quantum mechanics.

## 2. Characterization and Testing Samples ##

- **[UnitTesting](./Samples/src/UnitTesting)**:
This sample demonstrates how to use the Quantum Development Kit together with the [xUnit](https://xunit.github.io/) framework to check the correctness of quantum programs by testing the correctness and computing the metrics of various small quantum circuits.
- **[BitFlipCode](./Samples/src/BitFlipCode)**:
This sample shows how to use a simple quantum error correcting code to protect against errors in a quantum device.
- **[PhaseEstimation](./Samples/src/PhaseEstimation)**:
This sample introduces iterative phase estimation, an important statistical problem in analyzing the output of quantum programs.

## 3. Hamiltonian Simulation Samples ##

- *H₂ Simulation*
- **[H2SimulationCmdLine](./Samples/src/H2SimulationCmdLine)**:
This sample walks through the simulation of molecular hydrogen using the Trotter–Suzuki decomposition.
- **[H2SimulationGUI](./Samples/src/H2SimulationGUI)**:
This sample builds on *H2SimulationCmdLine* by using the [Electron](https://electronjs.org/) framework and the [chart.js](http://www.chartjs.org/) package to plot results asynchronously in a cross-platform application.
- *Ising Model Simulation*
- **[SimpleIsing](./Samples/src/SimpleIsing)**: This sample walks through constructing the time-evolution operator for the Ising model.
- **[IsingGenerators](./Samples/src/IsingGenerators)**: This sample describes how Hamiltonians may be represented using Microsoft.Quantum.Canon functions.
- **[AdiabaticIsing](./Samples/src/AdiabaticIsing)**: This sample converts a representation of a Hamiltonian using library data types into unitary time-evolution by the Hamiltonian on qubits.
- **[IsingPhaseEstimation](./Samples/src/IsingPhaseEstimation)**: This sample adiabatically prepares the ground state of the Ising model Hamiltonian, and then perform phase estimation to obtain an estimate of the ground state energy.
- **[IsingTrotterEvolution](./Samples/src/IsingTrotterEvolution)**: This sample walks through constructing the time-evolution operator for the Ising model using the Trotterization library feature.
- **[HubbardSimulation](./Samples/src/HubbardSimulation)**: This sample walks through constructing the time-evolution operator for the 1D Hubbard Simulation model.

## 4. Interoperability ##

- **[PythonInterop](./Samples/src/PythonInterop)** (Windows-only preview):
This sample walks through using Python to perform quantum process tomography on an operation written in Q#.
- **[FSharpWithQSharp](./Samples/src/FSharpWithQSharp)**:
This sample shows how to use Q# operations with an F# driver.

## 5. Qasm (Quantum Assembler Language) ##

- **[OpenQasm](./Samples/src/OpenQasm)**:
This sample shows that one can output a subset of the quantum operations of a Q# application in OpenQASM.
- **[Qiskit](./Samples/src/Qiskit)**:
This sample shows that one can run the quantum operations of a Q# application by using the OpenQASM output on the IBMQuantumExperience by changing the driver.
- **[OpenQasmReader](./Samples/src/OpenQasmReader)**:
This sample shows that one can convert OpenQasm 2.0 specifications to Q# methods. This allows one to import algorithms written in OpenQasm 2.0 to be used on the Microsoft Q# Simulator. Apart of the barrier gate (which has no meaning in Q#) all gates are converted to Q# constructions.
You can find instructions on how to install the Quantum Development Kit in [our online documentation](https://docs.microsoft.com/quantum/install-guide/), which also includes
an introduction to [quantum programming concepts](https://docs.microsoft.com/en-us/quantum/concepts/).
A [Docker](https://docs.docker.com/install/) image definition is also provided for your convenience, see below for instructions on how to build and use it.

## Getting started ##

If you're new to quantum or to the Quantum Development Kit, we recommend starting with the [Getting Started samples](./samples/getting-started/).

## Going further ##

As you go further with quantum development, we provide several different categories of samples for you to explore:

- **[Algorithms](./samples/algorithms)**:
These samples demonstrate various quantum algorithms, such as database search and integer factorization.
- **[Arithmetic](./samples/arithmetic)**:
These samples show how to coherently transform arithmetic data.
- **[Characterization](./samples/characterization)**:
These samples demonstrate how to learn properties of quantum systems from classical data.
- **[Chemistry](./samples/chemistry)**:
- **[Diagnostics](./samples/diagnostics)**:
These samples show how to diagnose and test Q# applications.
- **[Error Correction](./samples/error-correction)**:
These samples show how to work with quantum error correcting codes in Q# programs.
- **[Interoperability](./samples/interoperability)**:
These samples show how to use Q# with different host languages.
- **[Numerics](./samples/numerics)**:
The samples in this folder show how to use the numerics library.
- **[Runtime](./samples/runtime)**:
These samples show how to work with the Q# simulation runtime.
- **[Simulation](./samples/simulation)**:
These samples show how to simulate evolution under different Hamiltonians.

We also encourage taking a look at the [unit tests](./samples/tests) used to check the correctness of the Quantum Development Kit samples.

## Docker image

Expand Down
Loading

0 comments on commit 67f75e8

Please sign in to comment.