View on GitHub
Open this notebook in GitHub to run it yourself
Output:
get_circuit_metrics:
Output:
Output:
Output:
get_transpiled_circuit_metrics.
Visualization
When opening a quantum program using theshow command, the visualization provides details regarding the quantum circuit’s structure.
Key characteristics, such as gate count, qubit usage, and circuit depth, are displayed.
The visualization is organized according to the building blocks used during the quantum program construction.
These blocks represent modular components or routines in your quantum algorithm. By clicking on the ”+” sign on a block, you can expand it to reveal the underlying quantum gates, making it easier to inspect, debug, or understand the algorithm’s logic at both high and low levels.
This can be seen in the following figure: the left panel represents a high-level view showing the quantum blocks used in the algorithm, such as hadamard_transform and assign x**2 + 1, while the right panel shows an expanded view of the assign block, revealing the underlying gates, such as PHASE operations and quantum Fourier transform blocks.
Exporting and Sharing
In addition to visualizing a quantum program, the tool lets you export it in multiple formats, enabling integration with other tools and workflows:- Circuit languages: QASM, transpiled QASM, QIR, Cirq JSON, and Q#, for running the circuit on other quantum simulators, hardware platforms, and frameworks.
export function.
- Quantum program files: QPROG and JSON, which store the synthesized quantum program itself rather than a circuit in another language.
- Images: JPEG for a graphical image of the circuit, and LaTeX for a high-quality, pictorial representation ready for inclusion in LaTeX files.
Exercise
Create your ownmain function and synthesize it with different constraints.
Note that OptimizationParameter is only one kind of configuration possible.
Classiq synthesis engine also supports a rigid max_width constraint.