-
Notifications
You must be signed in to change notification settings - Fork 130
Circuit Editor
The Circuit Editor is a feature in the Quantum Development Kit that allows users to create, edit, and visualize quantum circuits directly within their Q# projects. This tool enhances the quantum development experience by providing a graphical interface to design quantum circuits alongside Q# code.
- Create and Edit Circuits: Users can easily create and modify quantum circuits, adding or removing qubits and operations as needed.
- Interoperability: The Circuit Editor integrates seamlessly with Q# projects, allowing for a smooth workflow between code and circuit diagrams.
- Visualization: Visualize quantum circuits to better understand quantum algorithms.
- Create or open an exiting Q# project.
- Add a new circuit file with the extension
.qsc
. - Open that file in VS Code. The editor is the default view for
.qsc
files.
The Circuit Editor in the Quantum Development Kit offers a range of features to enhance your quantum development experience. Here are some features you can explore:
- Adding Operations from the Toolbox: Add quantum operations from the toolbox into your circuit by click-and-drag.
- Removing Operations: Remove any unwanted operations from your circuit, either by dragging the operation out of the circuit, or right-click to bring up a context menu on the operation and select the "Delete" option.
- Moving Operations Around the Circuit: Rearrange the operations in your circuit by click-and-drag.
- Adding/Removing Qubits: Add or remove qubits with the "Add/Remove Qubit Lines" buttons.
- Adding/Removing Controls on Operations: Operation controls can be added or removed from operations by right-clicking the operation to bring up the context menu. From there you can select the "Add control" and "Remove control" options and selected the qubit line to add/remove a control. Controls can be also be removed through the "Remove control" option on their own context menu, or by dragging the control dot off the circuit. Controls are not supported on Measurement or Reset gates.
- Adjointing Operations: Operations can be adjointed via the "Toggle Adjoint" option on their context menu.
- Copying Operations: When dragging an operation, if the user holds down the Ctrl key when placing the operation, it will copy the operation instead of moving it.
- Operation Arguments: When placing an operation that requires an argument, the user will be prompted to enter a number or simple math expression that will be used as first-most argument to the operation. This argument can be edited by the "Edit Argument" option in the operation's context menu or by clicking the argument text on the operation.
Circuit files define operations that can be referenced elsewhere in the same Q# project in Q# code. They will appear like any other operation and are supported by the language service with features like completions, signature help, and go-to definition. The circuit file will define a namespace based on the file name, similar to how Q# files do, and the circuit described by the file will define an operation of the same name under that same namespace. For example, to reference the circuit defined in Foo.qsc in your Q# code, you'd use the following import statement: import Foo.Foo;
. In the future, we'd like to add the ability to support naming the circuit (and Q# operation) independently and support multiple circuits per file, resulting in multiple operations under the namespace.
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