Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
21 views

Multi controlled X (in general multi controlled Unitary) in QSharp

qiskit provide a way to apply a multicontrolled X gate (or in general any multicontrlled unitary) for exmaple the below code snippet apply the X gate on qubit dif , controlled on qubits present in ...
razeen shuja's user avatar
0 votes
1 answer
44 views

Q-sharp syntax error in quantum HHL algorithm

Here is a snippet of a code I am writing in Q#(QDK by Microsoft) trying to program the HHL algorithm. operation PrepareBState(register: Qubit[], coefficients: Double[]): Unit is Adj + Ctl { ...
Mark Noel's user avatar
0 votes
1 answer
91 views

Microsoft.Quantum.Oracles not found in VS Code in Azure Quantum SDK

My problem is that in Visual Studio Code, using Azure Quantum QDK (Q#) when I try to use Microsoft.Quantum.Oracles, it is not found. I have a Windows 11 machine: Edition Windows 11 Pro Version 22H2 ...
Peti's user avatar
  • 37
0 votes
1 answer
62 views

why is the output of Message and return result different in this Q# example?

I hope this is not a duplicate question or something I could have answered on my own. I was not able to find any answer to my question. I asked Microsoft copilot to explain the difference and it ...
tatmanblue's user avatar
  • 1,217
0 votes
1 answer
22 views

MeasureAllZ result comparison

use (qn, q2) = (Qubit[n], Qubit()); ..... let result = MeasureAllZ(qn); if (result != Zero) { set isConstant = false; } I have this very simple q# snippet. When I try to run it on Azure using ...
Steve's user avatar
  • 11.9k
0 votes
2 answers
103 views

Syntax for creating immutable array in Q#

I'm trying to run this example from https://learn.microsoft.com/en-us/azure/quantum/user-guide/language/statements/variabledeclarationsandreassignments.The compiler tells me that syntax for the array ...
Fourben's user avatar
-1 votes
1 answer
253 views

Install Quantum Development Kit (QDK) in Ubuntu, without conda

I mean to use QDK in Ubuntu 22.04LTS. I have a virtualenv, but no conda. I installed qsharp in my venv with $ pip3 install qsharp but then $ python -c "import qsharp" IQ# is not installed. ...
sancho.s ReinstateMonicaCellio's user avatar
0 votes
1 answer
51 views

QS5026 - The variable cannot be reassigned here

I'm following tutorial from the official Microsoft learning page (https://learn.microsoft.com/en-us/azure/quantum/tutorial-qdk-explore-entanglement?pivots=ide-azure-portal) about quantum entanglement. ...
Sabriael's user avatar
  • 382
0 votes
0 answers
118 views

%debug magic command not working in the Q# Jupyter Notebook environment

As per the documentation provided by Microsoft Azure Quantum at this link , I followed the steps given and installed Q# with Jupyter Notebook, using Anaconda. I then wrote the following Q# program in ...
NotTheRealV's user avatar
0 votes
1 answer
202 views

Get a sequence of numbers in Q#

I would like to get a list of a mathematical sequence in Q#, but I have an error that I can't solve. I use Azure Quantum to deploy the code in a Notebook. Here is what I do: First I connect to Azure ...
cypolo's user avatar
  • 37
2 votes
0 answers
562 views

VS Code installing a specific .NET SDK version

Is there anyway you can get VS Code to install a specific .NET SDK version that you have used in an old application? I have an old Q# app that uses SDK version 3.1.416 with netcoreapp 3.1 but I don't ...
Dina M.'s user avatar
  • 333
1 vote
1 answer
1k views

Why Pauli Z can be used to measure a single qubit ?

According to the Q# documentation, a single qubit can be measured by M.The method uses Pauli-Z. But why Pauli Z can be used to measure a single qubit? I have known the matrix of Pauli-Z like below: ...
W.xueshan's user avatar
0 votes
1 answer
50 views

What's the meaning of type 'd in q#

As shown in the picture above. What's the meaning of type 'd? What's type the return value of "Zipped" should be?
W.xueshan's user avatar
0 votes
1 answer
103 views

where can I get the detailed tutorial or document for Q# machine learning

Recently, I'm learning the Q# language for machine learning. The sample of half-moons has been run correctly. Now I want to learn the detail of the code. But there is too little explanation to find. ...
W.xueshan's user avatar
1 vote
1 answer
36 views

Result and IQArray could not be found

I am following this MS tutorial to add functionality to my Q#/C#host project. However, I get two errors on my operations: The type or namespace name 'Result' could not be found (are you missing a ...
Muhy's user avatar
  • 708
3 votes
1 answer
141 views

Missing types, namespaces, directives, and assembly references

I use VS Code for C# and Unity3D and TypeScript and Angular and Python programming, so I have pretty much every required extension, including the .NET Framework and Core as well as the Quantum ...
Muhy's user avatar
  • 708
0 votes
1 answer
913 views

How to create a new Q# Project in VSCode

I am trying to figure out how to start writing code using Microsoft Q# and QDK, but am running into a lot of issues as there aren't any good documents that help you set up projects from scratch. I ...
Noah Iarrobino's user avatar
1 vote
2 answers
70 views

VS2019 Community Edition Q# Application Hello World Reference problem

I am a Q# Beginner. Using Visual Studio 2019 Version 16.11.4. Community Edition Dotnet 5.0.401 Using the Q# Application Template I create a new Q# 'Hello World' Application. The Packages list ...
Bob Clegg's user avatar
1 vote
3 answers
295 views

How do I get Hellow Quantum world to run in Visual Studio 2019

This is my first attempt at Q#. I followed the instructions here: How do I get the missing dependencies? Please see my screen shot https://learn.microsoft.com/en-us/azure/quantum/install-command-line-...
DonRobb's user avatar
  • 57
1 vote
1 answer
196 views

Python calling q# file on IONQ QPU results in error about a System.Text.Json, Version=5.0.0.0 file not being found

Attempting to learn how to call q# from Python code and have it run for real on the IONQ QPU as it does (or appears to do) using VS and >dotnet run of the raw q# code. I followed the guides and ...
Joab.Ai's user avatar
  • 13
0 votes
1 answer
222 views

Cannot create Q# projects

I'm new to quantum computing and I've been trying to follow instructions on https://learn.microsoft.com/en-us/azure/quantum/install-command-line-qdk?tabs=tabid-vscode to dive into this field, but I've ...
Mattynator's user avatar
0 votes
2 answers
375 views

Return two numbers in Q Sharp (Q#) (Quantum Development Kit)

So, basically, I did the tutorial to create a random number on the website of Microsoft Azure and now I am trying to add some functionalities, including their suggestion add a minimum number. The ...
NiHaoLiHai's user avatar
1 vote
1 answer
244 views

How could you use Q# within Unity?

I was wondering how one would go about using Q# within Unity. I want to endow agents within a Unity simulation with quantum-like behavior, and I was wondering whether it was possible. I've seen ...
d4d3bru's user avatar
  • 11
1 vote
0 answers
317 views

Q# Create new project...' resulted in an error

I'm following these instructions to install Q# https://learn.microsoft.com/en-us/learn/modules/qsharp-create-first-quantum-development-kit/2-install-quantum-development-kit-code I have the following ...
Klinsey's user avatar
  • 111
1 vote
2 answers
223 views

Why can't I create a Q#create project on VisualStudio Code with QDK || ISSUE :command "'quantum.newProject' failed.)"

help regarding the issue below would be really appreciated : Command 'Q#: Create new project...' resulted in an error (Running the contributed command: 'quantum.newProject' failed.) I was trying to ...
Line.bery's user avatar
0 votes
1 answer
785 views

Q#: Error on dotnet run: System.ComponentModel.Win32Exception (5): Access is denied

I tried to install Q# a few days ago using the instructions listed here, but unfortunately, when I try to run the example program using the command dotnet run, it returns an error. Maybe I just did ...
Vorname Nachname's user avatar
0 votes
1 answer
105 views

Passing complex objects to Q# operations

I want to pass a complex object to a Q# operation from Python code. I defined the same data structure on both sides: in Python as a class and in Q# as a newtype. Than I prepared a JSON representation ...
Stefano's user avatar
  • 23
0 votes
2 answers
103 views

Q# : QDK Errors

I've recently tried to install the QDK via the VSCode extension in my Windows 10 Desktop and VSCode wasn't able to find the Microsoft libraries even after I was able to execute the code by the dotnet ...
Yezz123's user avatar
  • 67
0 votes
1 answer
86 views

My Q# language server won't stop downloading on VS Code

I'm trying to create a Q# New Project in VS Code, but VS Code won't let me do that until I have my Q# language server downloaded. I'm using a mac. And the Q# language server just kept downloading for ...
Lyra 's user avatar
1 vote
1 answer
178 views

How to return measurement probabilities from the QDK Full-state simulator?

Is there a way for the QDK full-state simulator to return the wavefunction or the measurement probabilities of a quantum state? Specifically to a C# host application? I want to sample from the output ...
Salonik Resch's user avatar
0 votes
1 answer
156 views

How to run Microsoft QDK from source

What is the general procedure for building and including QDK source code in a C# host project? Following Develop with Q# and .NET I have set up a C# host project which references a Q# library on linux....
Salonik Resch's user avatar
1 vote
1 answer
114 views

qsharp and python: remove 'preparing qsharp environment' message from console

I started tutorial of qsharp and i wrote my first qsharp and python (host) codes. But when i run qsharp codes in console, gets some messages in console. I want console shows only qsharp outputs.
user avatar
1 vote
1 answer
66 views

Importing function from IQsharp notebook to Python notebook

I'm working with two notebooks: one for Q# operations and one for python3 to activate and analyze - both of them are on the same directory. How can I import a Q# operation (from the IQsharp notebook) ...
BetaJoe's user avatar
  • 11
2 votes
1 answer
78 views

Q# unit testing to check phase

I want to test a phase oracle by testing if the phase of qubit flipped. I tried to do it by AssertQubitIsInStateWithinTolerance((Complex(0., 0.), Complex(-1., 0.)), qubit, 1e-5); But it doesn't ...
Tomer Shinar's user avatar
1 vote
1 answer
197 views

How to access the AST generated by the Q# compiler?

Background Part of the project I'm working on requires me to analyze Q# source code and perform specific actions when certain syntax elements are encountered. For example, say I'd like to count how ...
JakuJ's user avatar
  • 411
1 vote
1 answer
2k views

How to solve "jupyter_client.kernelspec.NoSuchKernel: No such kernel named iqsharp" in python?

I was trying to print hello world in Microsoft's Q#. When I ran the code It's shows like this. Even I installed the package. I don't know where the problem is. I think it's in jupyter notebook's ...
yasindce1998's user avatar
0 votes
1 answer
292 views

Difference between R1 and Rz in Q#

As far as I know, both Rz and R1 operations in Q# rotate a qubit about the z-axis. In Q# API reference (https://learn.microsoft.com/en-us/qsharp) I found out that the only difference between them is ...
old tankist's user avatar
0 votes
1 answer
276 views

Cannot create Q# Quantum Application in Visual Studio

I'm going to create Q# application for the first time. I installed the "Microsoft Quantum Development Kit" and I have .not core 3.1.301 (the latest) I use VS 2019 Community Edition. In VS, I see the ...
FLICKER's user avatar
  • 6,623
4 votes
1 answer
396 views

Q# Program does not contain a static 'Main' method suitable for an entry point

I'm creating a program in Q#. Problem You are given two qubits in state |00⟩. Your task is to create the following state on them: 1/3–√(|00⟩+|01⟩+|10⟩) You have to implement an operation which ...
user avatar
2 votes
1 answer
92 views

How can I change the format of the Qubit IDs of the Q# DumpMachine?

In Q#, the DumpMachine function gives an overview of the state of the quantum system. Its output (in a Q# Jupyter Notebook) looks like this: Is there a way for me to change the way the basis states ...
Mees de Vries's user avatar
3 votes
1 answer
433 views

Jupyter Notebook not finding IQSharp

I have been trying to get a Q# running for the Quantum Katas, but have been having some difficulty in finding the Q# kernal. The only kernal that shows up is the Python 3 one which is used for the ...
DJJ's user avatar
  • 31
0 votes
0 answers
39 views

Changing the signature of EntryPoint opeartion in auto-generated drivers

It appears that Q# now auto-generates C# drivers from annotations in new versions. When creating a plain command-line project from a VS Code template, we are presented with the following operation: @...
Regan Koopmans's user avatar
1 vote
0 answers
257 views

Q# Could Not Find Workspaces due to DotNet Core

I get error for every parts of the code since I think net core problem. /usr/local/share/dotnet/sdk/3.1.300/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(59,5): ...
CANKAN SUDOKUMATİK's user avatar
1 vote
1 answer
148 views

Jupyter Notebook Q# kernal not connecting

I recently updated iqsharp(from 0.10 to 0.11) for jupyter notebooks (via Anaconda) and ever since, the Q# kernel stopped connecting when I open a new or existing Q# notebook. I have tried uninstalling ...
Nk77's user avatar
  • 13
0 votes
2 answers
413 views

Unable to build a Q# program in VS Code

I am new to quantum computing and have just installed Microsoft's Visual Studio Code and the QDK extension for it. However, when I try to build and run (dotnet run from the terminal), it is unable to ...
RI98's user avatar
  • 57
1 vote
1 answer
181 views

Why do I get an error when I use DumpMachine in q#?

Here is my code: using (q = Qubit()) { Message("Input:"); Message("q = ∣0❭, index = 1"); Message("Requaired Output:"); Message("∣0❭: 0.707107 + 0....
egjlmn1's user avatar
  • 324
1 vote
1 answer
135 views

How do you take an user input?

How do you take an user input as integer or string?
Prabesh Upreti's user avatar
0 votes
1 answer
548 views

Python/Q#: Module not found error, with .qs file in the same directory

Lately I started working with Q# and python as host language. I was working on a project and everything seemed fine. Suddenly I get the error "module not found" and I seem to get it in all my previous ...
PhPanda's user avatar
  • 101
0 votes
1 answer
117 views

Polynomial Equations in Q# E=MC^2

I am trying to understand how to use quantum computing and have started to understand some of the basic gates and other concepts, but am not able to understand how to put it to practice in real world ...
Kiran's user avatar
  • 3,027
0 votes
1 answer
4k views

"jupyter-kernelspec" not found while installing iqsharp however it exists on PATH

While installing QDK for use with python as described in this guide, on executing dotnet iqsharp install I get the following exception Traceback (most recent call last): File "c:\users\hp\appdata\...
Raghav Kumar's user avatar