-
Notifications
You must be signed in to change notification settings - Fork 127
Circuit Editor Bug Bash Instructions
-
Create an Empty Project Folder
- In your file system, create a new, empty folder for your Q# project.
-
Open the Folder in VS Code
- Launch VS Code.
- Use File > Open Folder... to open your new project folder.
-
Create a Q# Project
- In the VS Code file explorer, right-click the empty folder.
- Select "Create Q# Project" from the context menu.
- This will scaffold the necessary project files and folders.
-
Add a Circuit File
- Inside the src folder, add a new file with the .qsc extension (for example, MyCircuit.qsc).
- You can now open this file and use the Circuit Editor to design your quantum circuit.
Test each action and note any unexpected behavior or UI issues.
-
File Operations
- Create a new circuit file.
- Open an existing circuit file.
- Open an empty circuit file.
Example of an empty or new circuit file:
-
Gate Operations
- Add a gate from the toolbox by dragging a gate from the toolbox onto the circuit.
- Remove a gate by dragging it off the circuit or using its context menu. Context menus for gates and other circuit elements can be found by right-clicking the element.
- Add controls to a gate using the gate's context menu.
- Remove controls by dragging them off the circuit or using context menu on gate or control.
Example of populating a circuit:
-
Qubit Operations
- Add qubits by dragging gates onto the ghost line.
- Move qubit lines by dragging the qubit state label on the left of the circuit. Try swapping and reordering qubits with and without gates.
- Verify trailing (bottom) qubit lines are removed.
- Verify non-trailing empty qubit lines are allowed.
- Delete qubits by dragging the qubit line off the circuit.
Example of moving qubits:
-
Gate Movement
- Try moving gates onto existing gates/controls (should be blocked except swapping with own control).
- Move gates into new/existing columns (start, middle, and end of circuit).
- Verify empty columns are removed.
- Move gates with controls (controls move with gate).
- Make copies of a gate by moving it while holding down the Ctrl key.
Example of gate movement:
-
Gate Arguments
- Add a gate that requires arguments (prompt appears).
- Test argument validation (empty, invalid, valid input). Only simple arithmetic expressions are allowed.
- Edit arguments by clicking on the argument on the gate or through the gate's context menu.
- Use Pi button or enter "pi".
Example of Adding a gate with an argument:
-
Measurement Gates
- Add multiple measurement gates to the same qubit.
- Move measurement gates and verify lines update correctly.
Example of measurement lines readjusting:
Circuits defined in circuit files are exposed to Q# as operations. In the same project as the circuit file, find the Main.qs file and the Main operation or entry point. In the Main operation's body, start typing the name of the circuit file and you should see an auto-completion popup for the circuit operation with the
symbol next to it. Select the auto-completion and Q# will insert the import statement into your code and complete the name of the circuit operation. The
import statement will look something like
import MyCirucit.MyCircuit;
. Please test the following scenarios:
-
An empty circuit operation will take no arguments. Otherwise it will take a single qubit register in the form of a
Qubit
array. The description of the circuit should tell the user how many qubits are expected in the array. If less than the necessary qubits are provided, a runtime error should occur. -
If the circuit contains no measurements or reset gates (blue gates in the default VS Code theme), then the operation will be adjointable and controllable.
-
The operation will return
Unit
unless there are measurement gates in the circuit. If there is one measurement, it will return a singleResult
for that measurement. If there are multiple measurements, it will return aResult
array. The order of results in the array correspond to the order of the measurements in the circuit, by column left-to-right first, then if multiple measurements are in the same column, top-to-bottom within a column. -
The signature of the circuit operation should update in real time with edits to the circuit file.
-
The Q# program should run with calls to the circuit file.
Q# Wiki
Overview
Q# language & features
- Q# Structs
- Q# External Dependencies (Libraries)
- Differences from the previous QDK
- V1.3 features
- Curated list of Q# libraries
- Advanced Topics and Configuration
OpenQASM support
VS Code
Python
Circuit diagrams
Azure Quantum
For contributors