microsoftdocs / quantum-docs-pr Goto Github PK
View Code? Open in Web Editor NEWSources of the Microsoft Quantum Development Kit documentation
Home Page: https://docs.microsoft.com/quantum/
License: Creative Commons Attribution 4.0 International
Sources of the Microsoft Quantum Development Kit documentation
Home Page: https://docs.microsoft.com/quantum/
License: Creative Commons Attribution 4.0 International
As a recent learner of Q# I found that there are a lot of learning resources but they are sparsed or not explained in the main website. For example, I've been reviewing the main site for one month and I've found just now the two fantastic compilations of resources in https://qsharp.community/ and https://github.com/ebraminio/awesome-qsharp/ by reading issue #466 instead of from the main site.
Most new users will start using and learning Q# through the material presented in the main site, but there is not a complete compilation of learning resources on the main site like the ones cited above (or even an easy to find link to them).
There's the section "For more information", but it seems more oriented to provide useful references for advanced topics of Quantum Computing rather than learning material for Q#.
I wrote a small subsection Learning materials at the beginning of Q# Manual, but still is incomplete and it just will contribute to create more sparsity by adding a new different compilation in another random place.
I think we should create a section (or maybe a subsection on Getting started or Q# manual (?)) on the main site as an official and structured compilation of learning resources, explaining what the resources are for and how to use them depending on the level of expertise of the reader. This will help the reader to have a fixed point of reference for obtaining material. It will also help us by needing to keep up to date one single compilation that we can refer to in other sections, blogs... instead of having to update manually each compilation every time a new resource comes out.
Please, tell me what you think @cgranade, @bettinaheim, @bromeg. As I'm learning Q# from almost zero I could take care of and improve it as I learn and follow the different tutorials.
Briefly:
following instructions, cant install iqsharp.
in text:
C:\WINDOWS\system32>dotnet --list-sdks
2.1.503 [C:\Program Files\dotnet\sdk]
2.1.505 [C:\Program Files\dotnet\sdk]
2.1.602 [C:\Program Files\dotnet\sdk]
2.2.105 [C:\Program Files\dotnet\sdk]
2.2.202 [C:\Program Files\dotnet\sdk]
C:\WINDOWS\system32>dotnet tool install -g Microsoft.Quantum.IQSharp
Learn more about .NET Core: https://aka.ms/dotnet-docs
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli-docs
The .NET Core tools collect usage data in order to help us improve your experience. The data is anon
ymous and doesn't include command-line arguments. The data is collected by Microsoft and shared with
the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment
variable to '1' or 'true' using your favorite shell.
Read more about .NET Core CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
Successfully installed the ASP.NET Core HTTPS Development Certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only). For establis
hing trust on other platforms refer to the platform specific documentation.
For more information on configuring HTTPS see https://go.microsoft.com/fwlink/?linkid=848054.
error NU1101: Unable to find package microsoft.quantum.iqsharp. No packages exist with this id in so
urce(s): C:\Program Files\dotnet\sdk\NuGetFallbackFolder, Microsoft Visual Studio Offline Packages
The tool package could not be restored.
Tool 'microsoft.quantum.iqsharp' failed to install. This failure may have been caused by:
Hey there. Not sure where to ask but somehow found that similar to #335 so, I have no issue on dotnet restore
and dotnet run
my new project but VSCode fails like this,
[Error - 11:09:11 PM] MSBuild error in /opt/dotnet/sdk/2.2.100/NuGet.targets(123,7): The "RestoreForceEvaluate" parameter is not supported by the "RestoreTask" task. Verify the parameter exists on the task, and it is a settable public instance property.
[Error - 11:09:11 PM] MSBuild error in /opt/dotnet/sdk/2.2.100/NuGet.targets(114,5): The "RestoreTask" task could not be initialized with its input parameters.
[Error - 11:09:11 PM] Failed to restore project '.../Bell/Bell.csproj'.
[Error - 11:09:11 PM] MSBuild error in /opt/dotnet/sdk/2.2.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(208,5): The "ResolvePackageAssets" task failed unexpectedly.
System.IO.FileLoadException: Could not load file or assembly 'NuGet.Frameworks, Version=4.9.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621)
File name: 'NuGet.Frameworks, Version=4.9.0.6, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheWriter..ctor(ResolvePackageAssets task, Stream stream)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader.CreateReaderFromMemory(ResolvePackageAssets task, Byte[] settingsHash)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.CacheReader..ctor(ResolvePackageAssets task)
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ReadItemGroups()
at Microsoft.NET.Build.Tasks.ResolvePackageAssets.ExecuteCore()
at Microsoft.NET.Build.Tasks.TaskBase.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
Any pointer?
From Q# Language User Voice (ID:
34713733):
Example from documentation does not compile:
AssertQubitState(((1., 0.), (0., 0.)), qubits0, 1e-5);
However, this code does:
AssertQubitState((Complex(1., 0.), Complex(0., 0.)), qubits0, 1e-5);
Error being:
Severity Code Description
Error QS0001 Type mismatch for argument: (Microsoft.Quantum.Extensions.Math.Complex, Microsoft.Quantum.Extensions.Math.Complex) expected, but ((Double, Double), (Double, Double)) was provided
Error QS0001 expected type Microsoft.Quantum.Extensions.Math.Complex, instead got type (Double, Double)
Error QS0001 expected type Microsoft.Quantum.Extensions.Math.Complex, instead got type (Double, Double)
Hi guys! What a wonderful work in the Quantum quick start projects and the Q# overall documentation!
Really congratulations!
So, I'm here because, while I was studying and trying to understand the bell example code, I written down a LOT of comments, so after I've finished, I just figure it out that maybe it can be useful for someone else, but I don't know where to post it to help you guys, so that's why I'm opening this issue!
I've documented in a personal repo so, If you guys want to take a look at the Bell.qs
file, maybe can help to be in the official docs 💖
The Quantum Development Kit community includes people coming from a wide range of different backgrounds. One thing that might help members of the community who want to get involved with making contributions would be a guide that lists what kinds of contributions there are (e.g.: documentation, filing issues, code contributions), what tools we use to accept contributions (Git, GitHub, etc.), and which repos are used for what kinds of content.
As it stands, creating a new Q# project fails if you install the VS code extension, using these instructions: https://docs.microsoft.com/en-us/quantum/quickstart?tabs=tabid-vscode&view=qsharp-preview
The templates need to be installed as a separate step:
From within VS you can create a new project with the standard GUI option (right click solution, new project etc). If you want to create a project from the command line you have to install the project templates, which are a separate nuget package: https://www.nuget.org/packages/Microsoft.Quantum.ProjectTemplates/0.9.1908.2906
Link at the bottom of the page in "Multiple chemical representations defined using the Broombridge schema are provided here." is broken.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
In
StatePreparationComplexCoefficients function
The sample codes uses another function
StatePreparationPositiveCoefficients
but with complex coefficients
The latex formula on top is not rendered correctly.
Thanks!
The formula that follows "prepares the maximally entangled state" is incorrect
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The conceptual documentation should be updated to reflect changes made as a part of the work on microsoft/QuantumLibraries#35.
open
statements.The field names have been renamed in the code but not on any of the doc pages. Even the auto-generated API docs still show the old names.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Doing some prep for a summer school, Inoticed that I think it would be nice to give this link some consideration. It is basically the first place where we send people, and having followed it, I was really missing a "and now do that" kind of continuation/link in the opened notebook that would gently lead a newby towards doing something with it without having a concrete idea in mind of what to code. I'd suggest to link to the katas index?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I've seen that some operations (e.g. "Carry") are included in the Microsoft.Quantum.Arithmetic namespace by default, whilst there are some (e.g. "AddI") that need the Microsoft.Quantum.Numerics package installed.
It would be helpful if this could be refenced somewhere in the documentation, for example in the summary of Microsoft.Quantum.Arithmetic, that some of the operations in Arithmetic require the Numerics package with a link to the installation.
Thanks,
Frances
Link near the end of the article to "five-qubit perfect code" (https://arxiv.org/abs/1305.08) is broken.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
There's a lot of small LaTeX rendering issues here and there caused by the DocFX -> MathJax pipeline that would be good to resolve. In particular, we've set up macros like \ket
, \bra
, and \id
to help typeset different notation, such that relying more heavily on these macros can help make sure that things render consistently.
\left|\psi\right\rangle
-style notation with \ket{\psi}
(same with bra)\mathbb{1}
with \id
2 invalid cross reference(s) "<xref:Microsoft.Quantum.Chemistry.LadderOperators.LadderOperator>", "<xref:Microsoft.Quantum.Chemistry.LadderOperators.LadderSequence>".
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
With 0.6, the Microsoft.Quantum.Primitive namespace was deprecated in favor of Microsoft.Quantum.Intrinsic, but the trace simulator page still uses the old name.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Current version of .NET is 3; after installing this and trying to install the Jupyter kernel, got an error message. The kernel won't install unless it finds .NET 2; it did install after installing the older .NET version.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I removed this section from the style guide, as the @Private attributes does exist yet.
### Private or Internal Names ###
In many cases, a name is intended strictly for use internal to a library or project, and is not a guaranteed part of the API offered by a library.
It is helpful to clearly indicate that this is the case when naming functions and operations so that accidental dependencies on internal-only code are made obvious.
If an operation or function is not intended for direct use, but rather should be used by a matching callable which acts by partial application, consider using a name starting with `_` for the callable that is partially applied, and marking the function or operation as private with the <xref:microsoft.quantum.core.private> attribute:
```Q#
@Private()
operation _ApplyDecomposedOperation(decomposition : Int[], targets : Qubit[]) : Unit {
// ...
}
I will add it back in once 0.10 is release
When I run this step:
dotnet iqsharp install
I get this error:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.AspNetCore.App', version '2.2.0' was not found.
You can resolve the problem by installing the specified framework and/or SDK.
The .NET Core frameworks can be found at:
I have the latest version of .NET Core and the latest version of Python installed. OS X version is 10.14.6.
Thanks a lot,
-david
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
I think there might be a line missing in the instructions for installing IQ#:
The section under installing IQ# on https://docs.microsoft.com/en-us/quantum/install-guide/python?view=qsharp-preview does not mention the need to run "dotnet iqsharp install" after "dotnet tool install -g Microsoft.Quantum.IQSharp" which I think is necessary. What makes this particularly confusing is that if you don't run that, then the check (dotnet iqsharp --version) actually works, but IQ# does not (the Q# kernel is not properly registered from what I gather).
The step 5 is sort of not clear of where (which file) to change those two lines. Can this be addressed if possible?
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
1 invalid cross reference(s) ""<xref:microsoft.quantum.canon.multim>"".
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
At the moment, the current linear algebra conceptual article doesn't really connect out to how linear algebra is used in Q#. Using DumpMachine / DumpRegister and so forth should make it easier to integrate Q# examples into the conceptual documentation and make it more clear how linear algebra is used to specify the behavior of Q# operations.
(h/t @Haishi2016 for raising this issue at microsoft/QuantumLibraries#134)
For people using Visual Studio, we should point them to https://docs.microsoft.com/en-us/nuget/tools/package-manager-ui#updating-a-package for how to update a package within Visual Studio.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Running the samples results in a Dependency Issue / failure.
I can't cut/paste unfortunately, but the issue with with Powershell and SSL dependencies.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
There is a problem for the link in the "File Structure" section. Can you fix it? Thank you ^^
Another thing, is it possible to be in contact with a Q# developer? Because I need help to do something in relation with Q# in Visual Studio. Thank you.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
https://docs.microsoft.com/en-us/quantum/libraries/chemistry/samples/loading-from-file?view=qsharp-preview
Fix the variable in the line “var jordanWignerEncoding = JordanWignerEncoding.Create(generalHamiltonian);”
We should be using the variable “hamiltonian” described above, not “generalHamiltonian” which is not initialized. :)
1 invalid cross reference(s) ""microsoft.quantum.language.statements"".
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
This would be helpful when contributing to ensure that our markdown will render correctly when "built". Thanks!
I think there is some confusion with variables.
If the following is accepted as true:
Then shouldn't this:
As "m" denotes row, and "n" denotes column, and vectors have a single column, but can vary in rows.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
When I import qsharp in Python, I see the following error:
import qsharp
Preparing Q# environment...
...................Traceback (most recent call last):
File "", line 1, in
import qsharp
File "D:\Anaconda3\lib\site-packages\qsharp_init_.py", line 119, in
client = _start_client()
File "D:\Anaconda3\lib\site-packages\qsharp\clients_init_.py", line 47, in _start_client
raise Exception("Q# environment was not available in allocated time.")
Exception: Q# environment was not available in allocated time.
How to fix it? Any advice?
Thanks!
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
1 invalid cross reference(s) ""<xref:microsoft.quantum.canon.preparearbitrarystate>"".
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
After having done the steps on the "Writing first program page" my codes (macOS) look like this:
Bell.qs
namespace Quantum.Bell
{
open Microsoft.Quantum.Canon;
open Microsoft.Quantum.Intrinsic;
operation Set (desired: Result, q1: Qubit) : Unit {
if (desired != M(q1)) {
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 += 1;
}
}
Set(Zero, qubit);
}
// Return number of times we saw a |0> and number of times we saw a |1>
return (count-numOnes, numOnes);
}
}
and the Driver.cs looks like this:
using System;
using Microsoft.Quantum.Simulation.Core;
using Microsoft.Quantum.Simulation.Simulators;
namespace BellTest
{
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...");
Console.ReadKey();
}
}
}
However, I get the following error messages upon running:
Restore completed in 26.27 ms for /Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj.
/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Driver.cs(18,31): error CS0234: The type or namespace name 'Run' does not exist in the namespace 'BellTest' (are you missing an assembly reference?) [/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj]
/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Driver.cs(19,26): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numZeros'. [/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj]
/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Driver.cs(19,36): error CS8130: Cannot infer the type of implicitly-typed deconstruction variable 'numOnes'. [/Users/danstanescu/Dropbox/JupyterNotebooks/MicrosoftQDK/Bell/Bell.csproj]
The terminal process terminated with exit code: 1
Any help will be greatly appreciated.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The current testing and debugging article uses the term "assertion" to include both assertions (that is, diagnostic operations that depend on state owned by a target machine) and facts (diagnostic functions that depend only on their actual inputs). We should clarify, as these two kinds of diagnostic conditions are semantically distinct, and are referred to in the Q# standard libraries by different names. For example, Microsoft.Quantum.Diagnostics.Fact
is a function, while Microsoft.Quantum.Diagnostics.AssertQubitIsInStateWithinTolerance
uses the verb "assert" to indicate that the Q# program needs to ask the target machine to check the state associated with the inputs to resolve the condition.
please check the last equation ( "For example, if we wish to apply the
X gate to the first qubit and then perform a CNOT between the second and third qubits we may express this transformation as"). The dimensions of the two sides of the equation are out of sync.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
In Installation section, the command
dotnet new console -lang Q# -o myApp
cd MyApp
dotnet run
has a typo, you should write cd myApp
.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
It may be trivial given the context, but what does the
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
the example code in:
quantum-docs-pr/api/prelude/microsoft.quantum.extensions.testing.assertqubitstate.yml
does not compile for me.
To make it work I had to:
Thanks!
I was reading through the QDK online docs recently and noticed that there are a couple of features/buttons missing from the built docs pages. The feature to be able from the doc page to directly link back to the right file in this repo to make an edit/fix is really helpful, as well as the ability to see if there are open issues on a docs page without going directly to GitHub. You can see an example of this on other MSFT docs sites: https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/tutorial-console?view=vs-2019
There is 2 more buttons in the header,
and an embedded GitHub issue thing at the bottom.
I feel like these used to exist on the QDK pages, but I am not sure.
Thanks!
Sarah
Hey there, I followed installation instructions on for Linux by installing sudo apt-get install dotnet-sdk-2.1
and issuing dotnet new -i "Microsoft.Quantum.ProjectTemplates::0.3.1811.203-preview"
and it says
$ dotnet new -i "Microsoft.Quantum.ProjectTemplates::0.3.1811.203-preview"
Restoring packages for /home/ebrahim/.templateengine/dotnetcli/v2.1.500/scratch/restore.csproj...
Installing Microsoft.Quantum.ProjectTemplates 0.3.1811.203-preview.
Generating MSBuild file /home/ebrahim/.templateengine/dotnetcli/v2.1.500/scratch/obj/restore.csproj.nuget.g.props.
Generating MSBuild file /home/ebrahim/.templateengine/dotnetcli/v2.1.500/scratch/obj/restore.csproj.nuget.g.targets.
Restore completed in 193.76 ms for /home/ebrahim/.templateengine/dotnetcli/v2.1.500/scratch/restore.csproj.
Usage: new [options]
Options:
-h, --help
[...]
Maybe something I'm missing or it is not ".NET Core SDK 2.0 or later"?
I think that the variable "i" should be "index" in following code (control flow example).
// ...
for (qb in qubits) { // qubits contains a Qubit[]
H(qb);
}
mutable results = new (Int, Results)[Length(qubits)];
for (index in 0 .. Length(qubits) - 1) {
let measured =
set results w/= index <- (index, M(qubits[i]));
}
mutable accumulated = 0;
for ((index, measured) in results) {
if (measured == One) {
set accumulated += 1 <<< index;
}
}
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The current For more information article is missing some newer resources, such as those listed at qsharp.community and https://github.com/ebraminio/awesome-qsharp/, and is missing a lot of links. It also might be good to refactor slightly, for instance to move Kitaev's book out of the "for beginners" section.
[Enter feedback here]
In the transformation from the creation operator to its Pauli equivalent, the summation doesn't actually equal the given matrix. Similarly, the annihilation operator doesn't equal it's Pauli equivalent. The actual formulas are used later on in the text, but the first mention is incorrect:
(also, if possible, the spacing should be fixed)
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
The script under "The full routine now looks like this:" on line 4 or 5, there is an extra "{" that should be removed.
⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
Add Tracer information there.
(and toffoli and others)
In the section Quantum Circuits , shouldn't $\text{ CNOT}{01}(H\otimes 1)$ actually be $\text{ CNOT}{01}(1\otimes H)$ for creating maximally entangled two-qubit state ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.