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 (Graph) – 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:

float