Git Product home page Git Product logo

microsoft / quantum Goto Github PK

View Code? Open in Web Editor NEW
3.8K 261.0 918.0 32.61 MB

Microsoft Quantum Development Kit Samples

Home Page: https://docs.microsoft.com/quantum

License: MIT License

Batchfile 0.01% Python 0.64% Shell 0.07% PowerShell 0.87% Dockerfile 0.10% Q# 13.59% C# 5.85% Jupyter Notebook 77.00% HTML 0.27% JavaScript 0.25% F# 0.03% TypeScript 0.25% CSS 0.03% CMake 0.07% C++ 0.97%
quantum-development-kit quantum qdk quantum-computing qsharp python

quantum's Introduction

DEPRECATION NOTICE

This repository is deprecated.

For the Modern QDK repository, please visit Microsoft/qsharp.

For samples that use the Azure Quantum Python package, please visit the Azure Quantum Python repository.

You can also try out the Modern QDK in VS Code for Web at vscode.dev/quantum.

For more information about the Modern QDK and Azure Quantum, visit https://aka.ms/AQ/Documentation.

Classic QDK

Binder

These samples demonstrate the use of the Quantum Development Kit for a variety of different quantum computing tasks.

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.

Getting started

You can find instructions on how to install the Quantum Development Kit in our online documentation, which also includes an introduction to quantum programming concepts.

For a quick guide on how to set up a development environment from scratch using Visual Studio Code or GitHub Codespaces, see here.

A Docker image definition is also provided for your convenience, see here for instructions on how to build and use it.

First samples

If you're new to quantum or to the Quantum Development Kit, we recommend starting with the Getting Started samples.

After setting up your development environment using one of the options above, try to browse to samples/getting-started/teleportation via the terminal and run dotnet run. You should see something like the following:

Round 1: Sent False, got False.
Teleportation successful!
Round 2: Sent True, got True.
Teleportation successful!
Round 3: Sent False, got False.
Teleportation successful!
Round 4: Sent False, got False.
Teleportation successful!
Round 5: Sent False, got False.
Teleportation successful!
Round 6: Sent False, got False.
Teleportation successful!
Round 7: Sent True, got True.
Teleportation successful!
Round 8: Sent False, got False.
Teleportation successful!

Congratulations, you can now start quantum programming!

Going further

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

  • Algorithms: These samples demonstrate various quantum algorithms, such as database search and integer factorization.
  • Arithmetic: These samples show how to coherently transform arithmetic data.
  • Characterization: These samples demonstrate how to learn properties of quantum systems from classical data.
  • Chemistry: These samples demonstrate the use of the Quantum Chemistry library.
  • Diagnostics: These samples show how to diagnose and test Q# applications.
  • Error Correction: These samples show how to work with quantum error correcting codes in Q# programs.
  • Interoperability: These samples show how to use Q# with different host languages.
  • Machine Learning: These samples demonstrate how to train simple sequential models on half-moons and wine datasets.
  • Numerics: The samples in this folder show how to use the numerics library.
  • Runtime: These samples show how to work with the Q# simulation runtime.
  • Simulation: These samples show how to simulate evolution under different Hamiltonians.

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

Setting up your development environment

This repo contains several configuration files that will make it easy to get started with coding. Below we lay out some instructions for getting started with VSCode or with Jupyter notebooks.

Visual Studio Code

If you prefer to develop code locally, we recommend to install an editor such as Visual Studio Code. Make sure to install the .NET Core SDK 3.1 or later on your local machine. For more detailed instructions on how to set up VS Code for development with the QDK, go to our docs here.

Once you have installed VS Code and the .NET Core SDK, download this repository to your computer and open the folder in VS Code. The editor will automatically recognize the files in the .vscode folder and request you to install the recommended extension. This includes the Microsoft Quantum Development Kit for Visual Studio Code extension, which is the fastest way to get started with the QDK.

Open a terminal to start running your first samples (see here).

Running a Jupyter Notebook with Docker

Another way to quickly start developing in Q# is to use Docker and launch a Jupyter notebook on your local machine. You can use the included Dockerfile to create a docker image with all the necessary libraries to use the Quantum Development Kit to build quantum applications in C#, Python or Jupyter.

Once you have installed Docker, you can use the following commands to get you started:

To build the docker image and tag it iqsharp:

docker build -t iqsharp .

To run the image in the container named iqsharp-container with interactive command-line and redirect container port 8888 to local port 8888 (needed to run jupyter):

docker run -it --name iqsharp-container -p 8888:8888 iqsharp /bin/bash

From the corresponding container command line, you can run the C# version of the Teleportation sample using:

cd ~/samples/getting-started/teleportation && dotnet run

Similarly, you can run the Python version of the Teleportation sample using:

cd ~/samples/getting-started/teleportation && python host.py

Finally, to start Jupyter Notebook within the image for the Teleportation sample, use:

cd ~/samples/getting-started/teleportation && jupyter notebook --ip=0.0.0.0 --no-browser 

Once Jupyter has started, you can open in your browser the Teleportation notebook (you will need a token generated by jupyter when it started on the previous step):

http://localhost:8888/notebooks/Notebook.ipynb

Once you're done, to remove container named iqsharp-container:

docker rm --force iqsharp-container

quantum's People

Contributors

achocron avatar anjbur avatar anpaz avatar ashwinmayya avatar bamarsha avatar banani-rath avatar bettinaheim avatar cesarzc avatar cgranade avatar crazy4pi314 avatar dependabot[bot] avatar dmitryvasilevsky avatar geduardo avatar israelmiles avatar kuzminrobin avatar markklink avatar martinquantum avatar masenol avatar msoeken avatar ricardo-espinoza avatar rmshaffer avatar rolfhuisman avatar scottcarda-ms avatar supernova-eng avatar swernli avatar tcnickolas avatar thomashaener avatar vadym-kl avatar vxfield avatar xinyi-joffre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quantum's Issues

Questions about the future

The Quantum Dev Kit is great and the tutorial are well done, but i have a few question about the future:

  1. Will it be available on Linux or Mac OS in the future?
  2. Will it be usable even without Visual Studio (ex: with a normal text editor)?
  3. Would the Q# assembly be invoked also from other languages like C++?

I hope the Microsoft Quantum Project will group up even more!
Regards
Manuele

Unable to use shift operator

According to https://docs.microsoft.com/en-us/quantum/quantum-qr-expressions?view=qsharp-preview, Q# provides arithmetic shift operator <<< and >>>.

And since Q# uses Int64 type to express integer, following code

for (x in 0 .. (2 <<< bitCount))
{
    // do some stuffs...
}

translates to

foreach (var x in new Range(0L, (2L << bitCount)))
{
    // do some translated stuffs...
}

and since both left hand and right hand is Int64, C# compiler throws following error:

error CS0019: Operator `<<' cannot be applied to operands of type `long' and `long'

I think Q# compiler should translate arithmetic shift to something else, such as function does arithmetic shift with 2 Int64 values.

The name 'BellTest' does not exist in the current context

I get this error when compiling and running the tutorial example here using

  • VisualStudioCode 1.28.2
  • .NET 2.1.403
  • macOS Mojave
  • Microsoft.Quantum.ProjectTemplates::0.3.1810.2508-preview

The Q# code is

namespace Quantum.Bell
{
    open Microsoft.Quantum.Primitive;
    open Microsoft.Quantum.Canon;

    operation Set (desired: Result, q1: Qubit) : Unit
    {
        let current = M(q1);
        if (desired != current)
        {
            X(q1);
        }
    }

    operation BellTest (count : Int, initial: Result) : (Int, Int)
    {
        mutable numOnes = 0;
        using (qubit = Qubit())
        {
            for (test in 1..count)
            {
                Set (initial, qubit);

                let res = M (qubit);

                // Count the number of ones we saw:
                if (res == One)
                {
                    set numOnes = numOnes + 1;
                }
            }
            Set(Zero, qubit);
        }

        // Return number of times we saw a |0> and number of times we saw a |1>
        return (count-numOnes, numOnes);
    }
}

while the Quantum Simulator in the Driver.cs was

using System;

using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;

namespace Bell
{
    class Driver
    {
        static void Main(string[] args)
        {
            using (var qsim = new QuantumSimulator())
            {
                // Try initial values
                Result[] initials = new Result[] { Result.Zero, Result.One };
                foreach (Result initial in initials)
                {
                    var res = BellTest.Run(qsim, 1000, initial).Result;
                    var (numZeros, numOnes) = res;
                    System.Console.WriteLine(
                        $"Init:{initial,-4} 0s={numZeros,-4} 1s={numOnes,-4}");
                }
            }

            System.Console.WriteLine("Press any key to continue...");
            System.Console.ReadKey();
        }
    }
}

The complete error was

ip-192-168-1-103:Bell loretoparisi$ dotnet run
Driver.cs(18,31): error CS0103: The name 'BellTest' does not exist in the current context [/Users/loretoparisi/Documents/Projects/AI/quantum/Bell/Bell.csproj]
Driver.cs(19,26): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numZeros'. [/Users/loretoparisi/Documents/Projects/AI/quantum/Bell/Bell.csproj]
Driver.cs(19,36): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numOnes'. [/Users/loretoparisi/Documents/Projects/AI/quantum/Bell/Bell.csproj]

The build failed. Please fix the build errors and run again.

I asked to SF here and a simpler working example is here

Thank you.

Cannot load Q# language extension

I downloaded the version 0.3.1811.203 and installed it.
I created a Q# project but I get the following message:

There was an error activating the remote language server, Q# Language Extension. For more details, please run devenv /log and examine ....\ActivityLog.xml file.

I ran it and I found a problem related to Q# language extension

_
ERROR System.SystemException: The trust relationship between the primary domain and the trusted domain failed. at System.Security.Principal.NTAccount.TranslateToSids(IdentityReferenceCollection sourceAccounts, Boolean& someFailed) at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean& someFailed) at System.Security.Principal.NTAccount.Translate(IdentityReferenceCollection sourceAccounts, Type targetType, Boolean forceSuccess) at System.Security.Principal.NTAccount.Translate(Type targetType) at System.Security.AccessControl.CommonObjectSecurity.ModifyAccess(AccessControlModification modification, AccessRule rule, Boolean& modified) at System.Security.AccessControl.CommonObjectSecurity.AddAccessRule(AccessRule rule) at System.IO.Pipes.PipeSecurity.AddAccessRule(PipeAccessRule rule) at Microsoft.Quantum.QsLanguageExtensionVS.QsLanguageClient.d__24.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageServiceBroker.RemoteLanguageClientInstance.d__49.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.Threading.ThreadingTools.d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.LanguageServer.Client.RemoteLanguageServiceBroker.RemoteLanguageClientInstance.d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
_

I am using Visual Studio 2017 enterprise 15.9
I uninstalled VS, cleaned up the registry and installed again.
The issue is still there.

I have no intellisense/tooltips and *.qs are not recognized as Q# code, no fileicons...

difference between VS template and docs

I was just walking through the tutorial from this doc page and I find that the VS solution file Operation.qs (that we rename to Bell.qs) has one extra line.

  • Snippet from the docs
namespace Quantum.Bell
{
    open Microsoft.Quantum.Primitive;

    operation Operation () : ()
    {
        body
        {

        }
    }
}
  • What VS generated in Operation.qs
namespace Quantum.Bell
{
    open Microsoft.Quantum.Primitive;
    open Microsoft.Quantum.Canon;

    operation Operation () : ()
    {
        body
        {

        }
    }
}

It still works just fine, just noting the mismatch in the docs and the VS template.

Thanks for such an awesome project!!

Grover search sample code idles for 11 or more database qubits

Hello,

I'm playing around with the Q# code samples, and I'm having some idle processor problems when increasing the database size in the DatabaseSearch case - most visibly with 11 database qubits or more.

In the DatabaseSearch case, a profiler indicates that more than 85% of the time is used by wait functions (see figure below). The memory usage also oscillates quite a bit. This doesn't happen with the Hubbard simulation sample - which also uses 12 qubits.

image

I'm doing the tests on a new computer, with Windows 10, two recent Xeon processors and 64Gb of RAM - the Grover sample with 11 database qubits uses at most 700Mb. The OMP_NUM_THREADS variable is set to 12 - the computer has a total of 56 logical threads available.

Thanks in advance

entanglement?

in the teleportation sample, cnot(msg,here) followed by h(msg). my question is why a h gate could be applied to single bit msg, since msg & here are in entanglement state, i.e. they are unseperatable . am i missed anything?

August 11, 2018 Dependency error in Microsoft Development Kit with latest Visual Studio 2017 Community

Hello.
August 11, 2018 When installing the latest Visual Studio 2017 Community, deploying github of Microsoft development kit (MDK) to solution, and executing teleportation, 48 errors and dependency warning appeared in Nuget and MDK. How can we solve it?
image

image

image

ーーー
example)
重大度レベル コード 説明 プロジェクト ファイル 行 抑制状態
エラー MSB3073 コマンド "dotnet "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\build../tools/qsc/qsc.dll" --input "DatabaseSearch.qs" --references "C:\Users\user\Source\Repos\Quantum\Microsoft.Quantum.Canon\bin\Debug\netstandard2.0\Microsoft.Quantum.Canon.dll" "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\lib\netstandard2.0\Microsoft.Quantum.MetaData.dll" "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\lib\netstandard2.0\Microsoft.Quantum.Primitives.dll" "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Common.dll" "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Core.dll" "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll" "C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Simulators.dll" --outputpath obj\qsharp\src" はコード -10 で終了しました。 DatabaseSearchSample C:\Users\user.nuget\packages\microsoft.quantum.development.kit\0.2.1806.3001-preview\build\Microsoft.Quantum.Development.Kit.targets 17
ーーー

Before debugging dependency warning mark

48 error during debugging.

image

error example)
Predefined type 'system.string' is not defined or imported

'object' does not include a constructor specifying argument 0.

Predefined type 'system.Object' is not defined or imported

CS0246 Name or namespace name 'QuantumSimulator' was not found (please make sure that the using directive or assembly reference is specified).

Predefined type 'system.lnt32' has not been defined or imported

Predefined type 'system.Boolean' has not been defined or imported

File Microsoft.Quantum.Canon.nuspec is missing

The file Microsoft.Quantum.Canon.nuspec is missing in the project Microsoft.Quantum.Canon.
there is the file Microsoft.Quantum.Canon.nuspec.v.template that is not included in the project Microsoft.Quantum.Canon.
filemissing

Can't create new Q# Project

Running dotnet new console -lang Q# --output Bell for the Hello World project results in this error:

'Q#' is not a valid value for -lang (language).

This is with dotnet version 2.1.301.

I'm unclear if this is a Quantum problem or dotnet problem

Define any own gate as Liqui|>

We could define our own gates at the Liqui|> library (for example as follows). Can we define our gates at MS Quantum Dev Kit? If we can define it, how do we define it at MS Quantum Dev Kit?

`any gate (as defined with any CSMat)

let GT (qs:Qubits) =
    let gate =        
        new Gate(
           Name = "GT",
            Help = "GT",
            Mat = CSMat(2,[0,0,1.,0.;0,1,1.,0.;1,0,0.,0.;1,1,0.,0.])
        )
    gate.Run qs

`

Possible IsingGeneratorSample extensions

  1. The function HeisenbergXXZGeneratorSystem uses Hamiltonian with 1/2 multiplier for ZZ term.
    I am thinking to adapt the code to consideration of perfect state transfer model there two basic
    examples of Hamiltonian are very similar: the first one simply drops the ZZ term,
    the second one has unit multiplier for ZZ term. Maybe it would be better to use the function
    with extra parameter instead of direct assignment jZZmultiplier = 0.5 in the body of the function to
    accept more general usability of the code?

  2. The similar idea is with TwoSiteGeneratorIndex. It has only one index, i.e., XY and YX terms useful
    for models with "chiral" chain may not be constructed. Maybe function should have two indexes in definition?

Q# compilation fails if user name contains a blank space

I am trying to run the TeleportationSample in Samples > 0.Introduction folder of QsharpLibraries solution. After setting the project as Startup project, I perform the build operation F5. But the build fails with error as :-

1>------ Build started: Project: Microsoft.Quantum.Canon, Configuration: Debug Any CPU ------
1>No executable found matching command "dotnet-C:\Users\deepa"
1>C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\build\Microsoft.Quantum.Development.Kit.targets(17,5): error MSB3073: The command "dotnet C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\build\../tools/qsc/qsc.dll --input "AmplitudeAmplification\AmplitudeAmplification.qs" "AmplitudeAmplification\Types.qs" "AmplitudeAmplification\Utils.qs" "Arithmetic\Arithmetic.qs" "Arrays\Arrays.qs" "Asserts\ClassicalAsserts.qs" "Asserts\QuantumAsserts.qs" "Combinators\ApplyMultiControlled.qs" "Combinators\ApplyToEach.qs" "Combinators\ApplyToEachIndex.qs" "Combinators\ApplyToFirst.qs" "Combinators\ApplyToPartition.qs" "Combinators\Bind.qs" "Combinators\Compose.qs" "Combinators\Curry.qs" "Combinators\OperationPow.qs" "Combinators\RestrictToSubregister.qs" "Combinators\With.qs" "DataStructures\Pairs.qs" "DataStructures\Stack.qs" "Data\GeneratorRepresentation.qs" "Enumeration\Filter.qs" "Enumeration\Fold.qs" "Enumeration\ForAll.qs" "Enumeration\ForAny.qs" "Enumeration\Map.qs" "Enumeration\Subarray.qs" "Enumeration\Trotter.qs" "IterateThroughCartesianProduct.qs" "Math\Complex.qs" "Math\Constants.qs" "Math\Functions.qs" "Math\Random.qs" "NoOp.qs" "PhaseEstimation\Iterative.qs" "PhaseEstimation\Quantum.qs" "PhaseEstimation\Robust.qs" "PhaseEstimation\Types.qs" "Qcvv\ProcessTomography.qs" "Qecc\5QubitCode.qs" "Qecc\7QubitCode.qs" "Qecc\BitFlipCode.qs" "Qecc\KnillDistill.qs" "Qecc\Types.qs" "Qecc\Utils.qs" "QFT.qs" "Simulation\Algorithms.qs" "Simulation\PauliEvolutionSet.qs" "Simulation\Techniques.qs" "Simulation\Types.qs" "StatePreparation\StatePreparation.qs" "UnsignedIntegers.qs" "Utils\ControlledOnBitString.qs" "Utils\Multiplexer.qs" "Utils\Paulis.qs" "Utils\Predicates.qs" "Utils\Ranges.qs" "Utils\TypeConversion.qs" --references "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.MetaData.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Primitives.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Common.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Core.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Simulators.dll" --outputpath obj\qsharp\src\" exited with code 1.
1>Done building project "Microsoft.Quantum.Canon.csproj" -- FAILED.
2>------ Build started: Project: TeleportationSample, Configuration: Debug Any CPU ------
2>No executable found matching command "dotnet-C:\Users\deepa"
2>C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\build\Microsoft.Quantum.Development.Kit.targets(17,5): error MSB3073: The command "dotnet C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\build\../tools/qsc/qsc.dll --input "TeleportationSample.qs" --references "D:\Repos\Quantum\Microsoft.Quantum.Canon\bin\Debug\netstandard2.0\Microsoft.Quantum.Canon.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.MetaData.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Primitives.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Common.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Core.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll" "C:\Users\test user\.nuget\packages\microsoft.quantum.development.kit\0.2.1802.2202-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Simulators.dll" --outputpath obj\qsharp\src\" exited with code 1.
2>Done building project "TeleportationSample.csproj" -- FAILED.
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

This might be the issue of dotnet CLI unable to reach the complete path as the correct path is C:/Users/test user/...(the path that follows) but it reads till C:\Users\test and then fails.

I am fairly new to both Quantum computing and dotnet environment so any help is highly appreciated.

RobustPhaseEstimationTest seems to be flaky

Currently running builds. Sometimes RobustPhaseEstimationTest failes unexpectedly.
Seen it in the travis run (https://api.travis-ci.org/v3/job/396045026/log.txt):

[xUnit.net 00:00:15.9331775] RobustPhaseEstimationTest [FAIL]
[xUnit.net 00:00:15.9351386] Microsoft.Quantum.Simulation.Core.ExecutionFailException : Assertion failed. Expected : -2.61799387799149 . Actual : 3.6646801022588
[xUnit.net 00:00:15.9366258] Stack Trace:
[xUnit.net 00:00:15.9383051] /home/travis/build/Microsoft/Quantum/Microsoft.Quantum.Canon/Asserts/ClassicalAsserts.qs(23,0): at Microsoft.Quantum.Canon.AssertAlmostEqualTol.<get_Body>b__5_0(ValueTuple3 _args) [xUnit.net 00:00:15.9392174] at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I args)
[xUnit.net 00:00:15.9396934] at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args) [xUnit.net 00:00:15.9400038] /home/travis/build/Microsoft/Quantum/LibraryTests/QcvvTests.qs(70,0): at Microsoft.Quantum.Tests.RobustPhaseEstimationTest.<get_Body>b__13_0(QVoid _args) [xUnit.net 00:00:15.9413737] C:\build-agent\_work\2\s\src\simulation\Testing\TestOperation.cs(40,0): at Microsoft.Quantum.Simulation.XUnit.TestOperation.<get_TestOperationRunner>b__6_0(IOperationFactory sim) [xUnit.net 00:00:15.9422095] /home/travis/build/Microsoft/Quantum/LibraryTests/SimulatorTestTargets.cs(58,0): at Microsoft.Quantum.Tests.SimulatorTestTargets.QuantumSimulatorTarget(TestOperation opData) [xUnit.net 00:00:15.9436640] Output: [xUnit.net 00:00:15.9571821] The seed, operation pair is ("Microsoft.Quantum.Tests.RobustPhaseEstimationTest",16645195) Failed RobustPhaseEstimationTest Error Message: Microsoft.Quantum.Simulation.Core.ExecutionFailException : Assertion failed. Expected : -2.61799387799149 . Actual : 3.6646801022588 Stack Trace: at Microsoft.Quantum.Canon.AssertAlmostEqualTol.<get_Body>b__5_0(ValueTuple3 _args) in /home/travis/build/Microsoft/Quantum/Microsoft.Quantum.Canon/Asserts/ClassicalAsserts.qs:line 23
at Microsoft.Quantum.Simulation.Core.Operation2.Apply(I args) at Microsoft.Quantum.Simulation.Core.Operation2.Microsoft.Quantum.Simulation.Core.ICallable<I,O>.Apply(I args)
at Microsoft.Quantum.Tests.RobustPhaseEstimationTest.<get_Body>b__13_0(QVoid _args) in /home/travis/build/Microsoft/Quantum/LibraryTests/QcvvTests.qs:line 70
at Microsoft.Quantum.Simulation.XUnit.TestOperation.<get_TestOperationRunner>b__6_0(IOperationFactory sim) in C:\build-agent_work\2\s\src\simulation\Testing\TestOperation.cs:line 40
at Microsoft.Quantum.Tests.SimulatorTestTargets.QuantumSimulatorTarget(TestOperation opData) in /home/travis/build/Microsoft/Quantum/LibraryTests/SimulatorTestTargets.cs:line 58
Standard Output Messages:
The seed, operation pair is ("Microsoft.Quantum.Tests.RobustPhaseEstimationTest",16645195)
`

Reference to unknown namespace Microsoft.Quantum.Primitive

I set up a QSharpTestProject,but I can't run it.
There are my problems.

error Reference to unknown namespace Microsoft.Quantum.Primitive QSharpTestProject1

error The namespace body is invalid

And I set Windows to use US number,but it can't run.

Add multi-line comments into the language

Right now, comments begin with forward slashes //. I propose that you add multi-line comments /* */ as they don't clutter a code base with multiple // on different lines for one comment. For documentation comments, how about adopting the doc-string implementation of Python? For example,

operation ApplyTwice<'T>(op : ('T => ()), target : 'T) : () {
/*
# Summary
Given an operation and a target for that operation,
applies the given operation twice.

# Input
## op
The operation to be applied.
## target
The target to which the operation is to be applied.

# Type Parameters
## 'T
The type expected by the given operation as its input.

 # Example
 ``Q#
 // Should be equivalent to the identity.
 ApplyTwice(H, qubit);
 ``

 # See Also
- Microsoft.Quantum.Primitive.H 
*/
    body {
        op(target);
        op(target);
    }
}

Looking forward to your feedback on this proposal.

Q# to C# compiler generates wrong decimal point on non-english computers

Compilation fails on my German computer, because the generated C# code contains ',' instead of '.' as decimal separator. Switching Windows to English number format fixes the issue.
That means there is at least one double to string conversion in the Q# compiler that misses CultureInfo.InvariantCulture and uses regional number format (German uses comma as decimal point).

AdiabaticIsing

Hi,

I have run the sample AdiabaticIsing in Visual Studio 2017 free edition, and I have got these errors (see attachment):

AdiabaticIsing.pdf

Does anyone have any similar errors?

Python interops with numpy arrays

Currently, the Python interops do not support numpy arrays as arguments. A lot of Python users and packages rely on numpy arrays since there are no built-in arrays available in Python, and it would be desirable for the python interops to be able to translate internally a numpy array as an array of float, int or booleans (e.g simply expose the data in Q# operations as a Double[], Int[], Bool[]).

Supporting 1D numpy arrays for these datatypes would already take us a long way, and could be generalized to multidimensional arrays later, if possible.

using azure for 40 qubit

How to simulate using azure for 40 qubit with microsoft quantum dev.kit (MQDK)? What do we need to do for azure and MQDK?

Integer Factorization Sample

I have tried to run Shor's algorithm on Visual Studio 2017, but there was an error message, saying that "period" in the qs file was undefined. The problem was that "period" was defined as EstimatePeriod(coprimeCandidate, number, useRobustPhaseEstimation). But the "EstimatePeriod" operation was defined after the "Shor" operation, in which "period" is defined. I've moved the codes for "EstimatePeriod" before the codes for "Shor". Now, it runs fine.

If needed, I can share the edited file.

Build errors on Windows 10, VS Community 2017 - Sample does not compile

Hi,

When compiling the sample I get these errors. Quantum assemblies are still not recognized as assemblies. These dependances are with yellow triangles in solution explorer.

C:/Users/benoit/.nuget/packages/microsoft.quantum.canon/0.3.1811.203-preview/lib/netstandard2.0/Microsoft.Quantum.Canon.dll : error QS7010: The given file is not an valid assembly. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]
C:/Users/benoit/.nuget/packages/microsoft.quantum.development.kit/0.3.1811.203-preview/lib/netstandard2.0/Microsoft.Quantum.Primitives.dll : error QS7010: The given file is not an valid assembly. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]
C:/Users/benoit/.nuget/packages/microsoft.quantum.development.kit/0.3.1811.203-preview/lib/netstandard2.0/Microsoft.Quantum.Simulation.Common.dll : error QS7010: The given file is not an valid assembly. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]
C:/Users/benoit/.nuget/packages/microsoft.quantum.development.kit/0.3.1811.203-preview/lib/netstandard2.0/Microsoft.Quantum.Simulation.Core.dll : error QS7010: The given file is not an valid assembly. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]
C:/Users/benoit/.nuget/packages/microsoft.quantum.development.kit/0.3.1811.203-preview/lib/netstandard2.0/Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll : error QS7010: The given file is not an valid assembly. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]
C:/Users/benoit/.nuget/packages/microsoft.quantum.development.kit/0.3.1811.203-preview/lib/netstandard2.0/Microsoft.Quantum.Simulation.Simulators.dll : error QS7010: The given file is not an valid assembly. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]
C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\build\Microsoft.Quantum.Development.Kit.targets(20,5): error MSB3073: La commande "dotnet "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\build../tools/qsc/qsc.dll" build --format MsBuild --input "TeleportationSample.qs" --references "C:\Users\benoit.nuget\packages\microsoft.quantum.canon\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.Canon.dll" "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.Primitives.dll" "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.QsCompilerCommon.dll" "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Common.dll" "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Core.dll" "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.QCTraceSimulatorRuntime.dll" "C:\Users\benoit.nuget\packages\microsoft.quantum.development.kit\0.3.1811.203-preview\lib\netstandard2.0\Microsoft.Quantum.Simulation.Simulators.dll" --output obj\qsharp\src" s'est arrêtée avec le code -2. [C:\Users\benoit\Quantum\Samples\src\Teleportation\TeleportationSample.csproj]

Thank you.

Q# Arthimatic syntax error

Below code throws an error for arthematic syntax finaloutput += 1 and no error if i rewrite this to finaloutput = finaloutput + 1. Is this a bug or is it on purpose?

mutable finaloutput = 0;
using(Qubits = Qubit[1])
{
Set(Initial,Qubits[0]);
X(Qubits[0]);
let res = M(Qubits[0]);
if(res == One)
{
set finaloutput += 1;
}

Set(Zero,Qubits[0]);

}

Solution does not build

1>------ Build started: Project: Microsoft.Quantum.Canon, Configuration: Debug Any CPU ------
2>------ Build started: Project: SimpleIsingSample, Configuration: Debug Any CPU ------
2>C:\Users\Test\quantum\Samples\SimpleIsing\SimpleIsing.qs(113,32,113,34): error CS1001: Identifier expected
2>C:\Users\Test\quantum\Samples\SimpleIsing\SimpleIsing.qs(113,32,113,34): error CS1002: ; expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\AmplitudeAmplification\AmplitudeAmplification.qs(421,40,421,43): error CS1001: Identifier expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\AmplitudeAmplification\AmplitudeAmplification.qs(421,40,421,43): error CS1002: ; expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\obj\qsharp\src\Math\Constants.g.cs(33,35,33,36): error CS1002: ; expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\obj\qsharp\src\Math\Constants.g.cs(33,35,33,36): error CS1513: } expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\RandomWalk.qs(81,39,81,57): error CS1001: Identifier expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\RandomWalk.qs(81,39,81,57): error CS1002: ; expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\RandomWalk.qs(82,40,82,58): error CS1001: Identifier expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\RandomWalk.qs(82,40,82,58): error CS1002: ; expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\Robust.qs(37,35,37,37): error CS1001: Identifier expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\Robust.qs(37,35,37,37): error CS1002: ; expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\Robust.qs(38,34,38,36): error CS1001: Identifier expected
1>C:\Users\Test\quantum\Microsoft.Quantum.Canon\PhaseEstimation\Robust.qs(38,34,38,36): error CS1002: ; expected

Comma instead of dot in generated code:
image

Unittest failures in build which don't seem related to code changes

If I look through https://travis-ci.org/Microsoft/Quantum/pull_requests i see a lot of failed builds, based on test failures that don't seem to be related to the change:

E.g.
https://travis-ci.org/Microsoft/Quantum/builds/396937185, log: https://api.travis-ci.org/v3/job/396937187/log.txt
RepeatUntilSuccessCircuitsTest, Seed: 525109616
MeasureWithScratchTest, Seed: 1049631137
BitFlipSampleWt1CorrectionTest, Seed: 3681483977
EstimateFrequencyTest, Seed: 2566129342
KDTest, Seed: 1627590700
KnillDistillationNoErrorTest, Seed: 4166661619
BayesianPEManualTest, Seed: 3270398307
Pi4YInjectionTest, Seed: 223591028
SingleQubitProcessTomographyMeasurementTest, Seed: 42796896
https://travis-ci.org/Microsoft/Quantum/builds/396906712, log: https://api.travis-ci.org/v3/job/396906714/log.txt
SuperdenseCodingTest, Seed: 2280605845
RepeatUntilSuccessStatePreparationTest, Seed: 4294571069
RepeatUntilSuccessCircuitsTest, Seed: 587399533
MeasureWithScratchTest, Seed: 2431261675
BitFlipSampleWt1CorrectionTest, Seed: 3472194629
EstimateFrequencyTest, Seed: 4232379153
KDTest, Seed: 2963729218
Pi4YInjectionAdjointTest, Seed: 1062934322
KnillDistillationNoErrorTest, Seed: 1606786275
BayesianPEManualTest, Seed: 1717820587
Pi4YInjectionTest, Seed: 4254770888

Based on trying to reproduce the seeds, they don't give issues.
Other builds also seem to have this behavior;
https://travis-ci.org/Microsoft/Quantum/builds/396394544, log: https://api.travis-ci.org/v3/job/396394546/log.txt
https://travis-ci.org/Microsoft/Quantum/builds/396372255, log: https://api.travis-ci.org/v3/job/396372257/log.txt
https://travis-ci.org/Microsoft/Quantum/builds/396045024, log: https://api.travis-ci.org/v3/job/396045026/log.txt

So I'm hypothesising its caused by either; an order of test or something that's not disposed.
Needs more diagnosing.

Issue adding Microsoft.Quantum.Canon NuGet package to UWP project

Hi, while I could add the Microsoft.Quantum.Development.Kit NuGet package to my Windows 10 C# UWP project, when I tried to add the Microsoft.Quantum.Canon package as well I got this issue:

Severity Code Description Project File Line Suppression State
Error NU1202 Package Microsoft.Quantum.Canon 0.2.1809.701-preview is not compatible with uap10.0.15063 (UAP,Version=v10.0.15063). Package Microsoft.Quantum.Canon 0.2.1809.701-preview supports: netstandard2.0 (.NETStandard,Version=v2.0)

Do you have some UWP compatible packages? I don't want to be limited to a C# Console app as the host app.

Thanks,
Rick

MacOS issues

i can't install QsharpVSIX.vsix file in my Env or it will work only for windows OS

MacOS Issues

i can't install QsharpVSIX.vsix file in my Env or it will work only for windows OS

Why is the Deutsch-Jozsa sample uses 0 for constant function?

The operation in Deutsch-Jozsa sample uses return ForAll(IsResultZero, resultArray);, and this operation's result is true when the function is constant. However, in every other literature they say if we measure 1 or -1, then the function is constant, and if 0, then it's balanced.

Build errors in Quantum Canon

I'm trying to run the TeleportationSample and am receiving build errors in quantum canon with the current build.

IDE
VS 2017 CE (15.4.4) with Universal Windows Platform development and .NET desktop development tools installed.

Steps so far
Cloned repo with Team Explorer
Opened the solution and installed F# and other dependencies
Manual check that NuGet packages have been restored
Set TeleportationSample as startup project
Attempted to start

Errors

Severity Code Description Project File Line Suppression State
Error CS1001 Identifier expected Microsoft.Quantum.Canon RandomWalk.qs 82 Active
Error CS1001 Identifier expected Microsoft.Quantum.Canon AmplitudeAmplification.qs 421 Active
Error CS1002 ; expected Microsoft.Quantum.Canon AmplitudeAmplification.qs 421 Active
Error CS1002 ; expected Microsoft.Quantum.Canon Constants.g.cs 33 Active
Error CS1513 } expected Microsoft.Quantum.Canon Constants.g.cs 33 Active
Error CS1001 Identifier expected Microsoft.Quantum.Canon RandomWalk.qs 81 Active
Error CS1002 ; expected Microsoft.Quantum.Canon RandomWalk.qs 81 Active
Error CS1002 ; expected Microsoft.Quantum.Canon RandomWalk.qs 82 Active
Error CS1001 Identifier expected Microsoft.Quantum.Canon Robust.qs 37 Active
Error CS1002 ; expected Microsoft.Quantum.Canon Robust.qs 37 Active
Error CS1001 Identifier expected Microsoft.Quantum.Canon Robust.qs 38 Active
Error CS1002 ; expected Microsoft.Quantum.Canon Robust.qs 38 Active

DumpRegister has certain rows swapped

Hi guys,

I'm sure this isn't the correct place to report this, but as far as I can tell the Microsoft.Quantum.Extensions namespace lives in the Primitives library and that isn't open sourced. I just don't know where else to put it or who to submit it to. Anyway, during my experiments I've run into two issues with DumpRegister - one of them is just a documentation thing, but I believe the other might be a bug.

Documentation Issue

The documentation issue is simply that DumpRegister seems to expect the register in little-endian format, but doesn't explicitly say that anywhere. Once you run it and look at the output, you get a message like this:

# wave function for qubits with ids (least to most significant): 0;1;2

So it does tell you that it will assume the register is little-endian, but the documentation for it doesn't mention that anywhere. It's easy to fix once you know what the function expects, it's just confusing at first since most of the literature (including the Katas) treats registers as big-endian.

Potential Bug

The bigger issue I'm seeing is that sometimes, the dumped states seem to be out of order. I ran into this while testing the canon QFT implementation with a 4-qubit register:

operation QftSandbox() : Unit
{
	using(register = Qubit[4])
	{
		X(register[3]);

		mutable le = BigEndianToLittleEndian(BigEndian(register));
		Message("Start: ");
		DumpRegister((), le!);
			
		QFT(BigEndian(register));

		set le = BigEndianToLittleEndian(BigEndian(register));
		Message("After QFT: ");
		DumpRegister((), le!);

		ResetAll(register);
	}
}

This will run QFT on the state |0001> which should produce a nice Heyser spiral like this:
image

However, this is the QFT output:

Start: 
# wave function for qubits with ids (least to most significant): 3;2;1;0
0:	0	0
1:	1	0
2:	0	0
3:	0	0
4:	0	0
5:	0	0
6:	0	0
7:	0	0
8:	0	0
9:	0	0
10:	0	0
11:	0	0
12:	0	0
13:	0	0
14:	0	0
15:	0	0
After QFT: 
# wave function for qubits with ids (least to most significant): 3;2;1;0
0:	0.25	0
1:	0.230969883127822	0.0956708580912724
2:	0.176776695296637	0.176776695296637
3:	0.0956708580912725	0.230969883127822
4:	0	0.25
5:	-0.0956708580912724	0.230969883127822
6:	-0.25	0
7:	-0.230969883127822	-0.0956708580912724
8:	-0.176776695296637	0.176776695296637
9:	-0.230969883127822	0.0956708580912725
10:	0	-0.25
11:	0.0956708580912724	-0.230969883127822
12:	-0.176776695296637	-0.176776695296637
13:	-0.0956708580912725	-0.230969883127822
14:	0.176776695296637	-0.176776695296637
15:	0.230969883127822	-0.0956708580912725

When graphed (I used plotly), it looks like this:
image

This looks like a mess after the 6th element, but the problem is pretty simple: some of the elements are in the wrong order. For this specific example, the following pairs needed to be swapped (note, these are zero-indexed):
6 and 8
7 and 9
10 and 12
11 and 13

With those elements swapped, the result looks correct. This could be a bug with QFT as well, but it seems to be giving me the expected answers so far. This problem doesn't happen with a 3-qubit register, I've only seen it on registers with 4+ qubits.

Build errors and failing NuGet package restore

Visual Studio Enterprise 2017, Version 15.6.6
.NET Framework, Version 4.7.02556
.NET Core SDK, Version 2.1.104
Quantum Development Kit, Version 0.2.1802.2202-preview

I was following the instructions on
https://docs.microsoft.com/en-us/quantum/quantum-installconfig?view=qsharp-preview&tabs=tabid-vs2017

The teleportation example runs correctly.

Trying to run all tests, I attempted a rebuild which gives 31 errors, many of which are like this:

Error QS1001 Assembly C:\Users...\Source\Repos\Quantum\Microsoft.Quantum.Canon\bin\Debug\netstandard2.0\Microsoft.Quantum.Canon.dll not found H2SimulationSampleCmdLine C:\Users...\Source\Repos\Quantum\Samples\H2SimulationCmdLine\EXEC 1

The file actually does exist in that location.

Also, trying to restore NuGet packages gives the following error.

NuGet package restore failed. Please see Error List window for detailed warnings and errors.
Time Elapsed: 00:00:02.5527360
========== Finished ==========

Any ideas, what's wrong here?

Visual Studio Quantum Development Kit IntegerFactorization's Speed

Visual Studio Microsoft Quantum Development Kit has the speed of a quantum computer, is not it?

Is it 100 million times faster than a classical supercomputer?

Quantum / Samples / IntegerFactorization /
I did not feel the speed if factoring decomposition using Shore's algorithm here.
Why?

In addition, here we are using long type in C #. With this, the number of digits is insufficient when prime factorization of the product (modulus) of prime numbers generated from a 64-bit public key.

image

I was hoping for a quantum computer. It is possible to solve prime factorization which was an answer time to become an astronomical figure in a short time.

Include QDK at Visual Studio install

It would be cool for people setting up new development environments to be able to select at install time to download and install the QDK. See the screen cap below for an example:

image

Thanks!

Missing Path to SDK Resolver DLL

Could not load SDK Resolver. A manifest file exists, but the path to the SDK Resolver DLL file could not be found.

I followed the instructions at https://docs.microsoft.com/en-gb/quantum/install-guide/vs-2017?view=qsharp-preview but when I click on Samples\QSharpSamples.sln, I get the above error. As the file paths after the quoted error message mention NuGetSdkResolver.dll, in accordance to the tip on the installation webpage, I tried to attempt a NuGet Package Restore based on the instructions at https://docs.microsoft.com/en-gb/nuget/consume-packages/package-restore. However, I cannot find NuGet Package Manager in Tools > Options.

Thank you for your time.

Add `uncompute` blocks to operations

It is often cheaper to uncompute an operation if you know that the result will be in the 0 state.

For example, if you know that the target qubit involved in a Toffoli operation will end up 0, you can perform the Toffoli with an X-basis measurement and a classically controlled CZ. This reduces the number of magic states required to perform an operation.

It is tedious to have to specify different names for the uncompute variants of operations. They should be merged, same as for adjoint and controlled operations.

(The tricky part of this, in terms of language design, is how to designate which qubits are being uncomputed.)

BellTest does not exist

When I try to run the example in "Creating a Bell State in Q #" I get the following errors and it is not compiled. (Framework 4.6.1, Platform target: x64)

1>------ Build started: Project: Bell, Configuration: Debug x64 ------ 1>C:\Users\engin\source\repos\Bell\Bell\Driver.cs(16,31,16,39): error CS0103: The name 'BellTest' does not exist in the current context 1>C:\Users\engin\source\repos\Bell\Bell\Driver.cs(17,26,17,34): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numZeros'. 1>C:\Users\engin\source\repos\Bell\Bell\Driver.cs(17,36,17,43): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numOnes'. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Bell.qs
`
namespace Quantum.Bell
{
open Microsoft.Quantum.Primitive;
open Microsoft.Quantum.Canon;

operation Set (desired: Result, q1: Qubit) : ()
{
    body
    {
        let current = M(q1);
        if (desired != current)
        {
            X(q1);
        }
    }
}

operation BellTest (count : Int, initial: Result) : (Int,Int)
{
    body
    {
        mutable numOnes = 0;
        using (qubits = Qubit[1])
        {
            for (test in 1..count)
            {
                Set (initial, qubits[0]);

                let res = M (qubits[0]);

                // Count the number of ones we saw:
                if (res == One)
                {
                    set numOnes = numOnes + 1;
                }
            }
            Set(Zero, qubits[0]);
        }
        // Return number of times we saw a |0> and number of times we saw a |1>
        return (count-numOnes, numOnes);
    }
}

}
`

driver.cs
`
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;

namespace Quantum.Bell
{
class Driver
{
static void Main(string[] args)
{
using (var sim = new QuantumSimulator())
{
// Try initial values
Result[] initials = new Result[] { Result.Zero, Result.One };
foreach (Result initial in initials)
{
var res = BellTest.Run(sim, 1000, initial).Result;
var (numZeros, numOnes) = res;
System.Console.WriteLine(
$"Init:{initial,-4} 0s={numZeros,-4} 1s={numOnes,-4}");
}
}
System.Console.WriteLine("Press any key to continue...");
System.Console.ReadKey();
}
}
}
`

Rotation should fail when the angle is NaN

Dear Microsoft Q# Developers and Researchers,

I just attended a workshop today at the University of Washington and got a chance to work through the Superposition Tutorial in Quantum-Katas. I was working on Task 9 and 10, and attempted to run some recursive code that is nonsensical in retrospect but somehow managed to pass the test cases:

Ry(ArcCos(1.0 / Sqrt(ToDouble(idx))) * 2.0, qs[idx]);

The most nonsensical part is that there is an off-by-one error in Ry(ArcCos(1.0 / Sqrt(ToDouble(idx))) * 2.0, qs[idx]);, when idx=0. ArcCos(1.0/Sqrt(ToDouble(idx))) should and does produce NaN after printing it out via "Message". But I don't understand why it passes the test cases. I'm confident this code shouldn't work so it might be the case that the Tutorial tests contain a bug (?) That or my current environment, the way I have it set up, is bugged.

Thank you very much for your time and consideration. Thanks also for developing this software and setting up the workshop here; it was loads of fun and I learned a lot. The instructors were wonderful (my apologies, I don't remember their names). Looking forward to future developments!

Best,
Kuikui

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.