QPanda3  0.1.0
Supported by OriginQ
Loading...
Searching...
No Matches
pyqpanda3.profiling.profiling Namespace Reference

Functions

 draw_circuit_profile (Union[pq.QCircuit, pq.QProg] circuit, dict gate_times, bool is_show=False, str out_file=None)
 Draw a profile of the quantum circuit's performance.
 
 _find_layers (G)
 
 draw_circuit_DAG (pq.QCircuit circuit, bool is_show=False, save_fn=None)
 Draw the Directed Acyclic Graph (DAG) representation of the quantum circuit.
 
 draw_circuit_features (Union[pq.QCircuit, pq.QProg] circuit, bool is_show=False, str save_fn=None, str title='')
 Draws the features of a quantum circuit and visualizes them as a radar chart.
 

Function Documentation

◆ _find_layers()

pyqpanda3.profiling.profiling._find_layers ( G)
protected

◆ draw_circuit_DAG()

pyqpanda3.profiling.profiling.draw_circuit_DAG ( pq.QCircuit circuit,
bool is_show = False,
save_fn = None )

Draw the Directed Acyclic Graph (DAG) representation of the quantum circuit.

Parameters
circuitThe quantum circuit object to be drawn, which contains the structure and details of the circuit.
is_showA boolean flag indicating whether to display the DAG graph after drawing. Defaults to False.
save_fnA function or method to save the generated DAG representation. If provided, the graph will be saved according to the specified function. If None, the graph will not be saved.
Returns
None, This function does not return a value but will draw the DAG representation of the quantum circuit and may display it or save it based on the provided parameters.

◆ draw_circuit_features()

pyqpanda3.profiling.profiling.draw_circuit_features ( Union[pq.QCircuit, pq.QProg] circuit,
bool is_show = False,
str save_fn = None,
str title = '' )

Draws the features of a quantum circuit and visualizes them as a radar chart.

This function takes a quantum circuit or program as input, computes various features such as connectivity, liveness, parallelism, entanglement, and depth, and then plots these features in a radar chart.

Parameters
circuitThe quantum circuit or program to analyze. This can be either an instance of pq.QCircuit or pq.QProg.
is_showA boolean flag indicating whether to display the plot. Defaults to False.
save_fnAn optional string for the filename to save the plot. If None, the plot will not be saved.
titleAn optional title for the plot. Defaults to an empty string.
Returns
None This function does not return any value. It directly generates and displays the radar chart based on the computed features.
Note
The function computes the following features:
  • Connectivity
  • Liveness
  • Parallelism
  • Entanglement
  • Critical Depth

◆ draw_circuit_profile()

pyqpanda3.profiling.profiling.draw_circuit_profile ( Union[pq.QCircuit, pq.QProg] circuit,
dict gate_times,
bool is_show = False,
str out_file = None )

Draw a profile of the quantum circuit's performance.

Parameters
circuitThe quantum circuit object to be drawn, containing the structure and information of the circuit.
gate_timesA dictionary where the keys are the names of the quantum gates and the values are the execution times of each gate (units can be seconds or milliseconds).
is_showA boolean flag indicating whether to display the graph after drawing. Defaults to False.
out_fileThe path and filename to save the output. If provided, the graph will be saved to this file. If None, the graph will not be saved.
Returns
None, This function does not return a value but will draw the performance profile of the quantum circuit and may save it to a file or display it based on the provided parameters.