iqm.benchmarks.optimization.qscore.compute_expectation_value

iqm.benchmarks.optimization.qscore.compute_expectation_value#

iqm.benchmarks.optimization.qscore.compute_expectation_value(counts: Dict[str, int], graph: Graph, qubit_to_node: Dict[int, int], virtual_nodes: List[Tuple[int, int]]) float#

Computes expectation value based on measurement results.

Parameters:
  • counts (Dict[str, int]) – key as bitstring, val as count

  • graph (networkx) – the MaxCut problem graph

  • qubit_to_node (Dict[int, int]) – mapping of qubit to nodes of the graph

  • virtual_nodes (List[Tuple[int, int]]) – list of virtual nodes in the graph

Returns:

expectation value of the cut edges for number of counts

Return type:

avg (float)