calculate_graph
- static FunctionNamespace.calculate_graph(*, graph, output_node_names, execution_mode='COMPILED', **kwargs)
Evaluate a graph corresponding to a set of generic functions.
Use this function to carry out computations expressed as a graph representing a collection of arbitrary functions.
- Parameters:
graph (qctrl.graphs.Graph) – The graph describing the outputs. It must contain nodes with names \(\{s_j\}\) (giving the output functions).
output_node_names (List[str]) – The names \(\{s_j\}\) of the graph nodes that define the output functions. The function evaluates these and returns them in the output.
execution_mode (qctrl.dynamic.types.graph.ExecutionMode, optional) – The execution mode to use for the calculation. Choosing a custom execution mode can lead to faster computations in certain cases. Defaults to compiled execution mode.
- Returns:
The result of a graph evaluation. It includes the evaluated outputs.
- Return type:
See also
calculate_optimization
Perform gradient-based deterministic optimization of generic real-valued functions.
Notes
This function computes arbitrary functions represented by a graph.
The graph is made up of primitive nodes defined in the graphs of the Q-CTRL Python package, where each node represents a function of previous nodes (or constant values). You can assign a name to any node and request a list of named nodes \(\{s_j\}\) as the outputs to be evaluated.
Examples
See the How to represent quantum systems using graphs user guide.