Analyzer Web Application¶
The Classiq analyzer application helps you visualize and analyze quantum circuits. The input to the application is a quantum circuit generated by the synthesis engine of the Classiq platform.
Access the Analyzer¶
You have a few options for accessing the Classiq analyzer application. First, before accessing the application, you need to authenticate to the Classiq VSCode extension and the Classiq Python SDK. See Getting Started.
Classiq Python SDK¶
- Synthesize a circuit using the Classiq Python SDK and then run this code:
from classiq import Analyzer, ModelDesigner model = ModelDesigner() circuit = model.synthesize() analyzer = Analyzer(circuit) analyzer.analyzer_app()
- OR run:
Classiq VSCode Extension¶
- When a
Generated Circuitfile is active in your VSCode editor, open the extension command window (Cmd+Shift+P in macOS) and type
Analyze Quantum Circuit From Generated Circuit.
- Drag and drop OR select a file that contains a quantum circuit synthesized using the Classiq platform (
circuit.save_result("file-name"))) into https://platform.classiq.io/circuit/new.
The Classiq analyzer circuit visualization tool provides a hierarchical image of the circuit, as well as a higher level interactive representation of functions, gates, qubits, and operations.
Once you have loaded and analyzed the quantum circuit input, the analyzer displays an interactive chart, like this:
The bars represent the functions used in the quantum algorithm, and the grid models the qubits employed in the quantum circuit. For a more detailed view, click the "+" button on the top left and see the gates that make up these functions.
Change the labels of functions and gates by double-clicking their captions:
By default, the qubits on which your quantum algorithm operates are named q0, q1, q2, etc. To rename the qubit lines in your circuit schema, double-click a qubit name and change it in the rename dialog.
Merging Wires into Registers¶
The qubit toolbar provides further insights into your quantum circuit analysis. It becomes visible as a popover whenever you click a qubit segment. To collapse adjacent qubits into a register view, choose two adjacent qubits simultaneously (using Ctrl on Windows and Cmd on a Mac) and click the "Merge" button.
To revert to the original view, click the "Unmerge" button.
For detailed information about the registers in your circuit, see the JSON representation of your circuit in the left side drawer of the application.
To give special labels to your qubit segments or to play around with the colors of the qubits, for example, to highlight particular portions of your quantum algorithm, use the qubit toolbar:
To analyze multiple circuits in the same session, see the analysis results of each quantum circuit in their separate tabs. To rename the title of each tab, double-click it.
To upload a new generated circuit, open a new tab by clicking the "+" button on the top right of the tab panel.
To inspect the structure and properties of your generated circuit, access the circuit inspector on the left. The inspector includes four tabs:
- The Full tab displays analysis information for the entire circuit. Selected functions/gates are highlighted in this tab as shown below. You can also click on a function name in the inspector to highlight the corresponding gate block in the circuit chart.
- The Function tab displays information specific to the function, such as the target qubits on which the function operates and the quantum gates it includes.
- The Information tab supplies general information on the selected function or gate, such as the registers, depth, and width.
- The search icon 🔍 let you search functions and gates by their names. Click any search result to locate it in the circuit chart view.
On the top right is the analyzer task bar:
The taskbar has these button groups described from left to right:
- This group controls the hierarchical view of the quantum circuit chart: expand all the functions and/or gates to the lowest level analysis of quantum gates utilized in your algorithm; or collapse all the bars and revert the chart to the original view displayed when the circuit input was first loaded, so that this single bar models your entire quantum algorithm.
- This (single) button exports your analysis insights into a JPEG image, JSON text file or an interactive HTML chart.
- The map button navigates through different components of your quantum circuit chart so you can shift the screen focus to gates and functions that are outside the view.
- This group scales your quantum circuit chart: scale the quantum circuit chart to the default scale value (currently 90%); zoom out of the quantum circuit chart; change the current scale or zoom level of the chart; or zoom in.