qat.plugins.ObservableSplitter

class qat.plugins.ObservableSplitter(splitting_method='naive', x_basis_change=None, y_basis_change=None, **kwargs)

A QPU Plugin that splits jobs that require observable sampling into jobs that only require computational basis measurements.

Parameters
  • splitting_method (optional, str) – Specify the splitting algorithm to be used (see below). Defaults to “naive”.

  • x_basis_change (optional, callable) – a (qbit, nbqbits) -> QRoutine method performing a Z -> X basis change on qubit qbit. The routine must have arity nbqbits. Defaults to a single H gate.

  • y_basis_change (optional, callable) – a (qbit, nbqbits) -> QRoutine method performing a Z -> Y basis change on qubit qbit. The routine must have arity nbqbits. Defaults to [PH(pi/2); RY(pi/2)].

The plugin implements three different approaches for the splitting:

  • “naive”: Each term of the observable will be individually sampled using an individual circuit.

  • “coloring”: Terms will be grouped into trivially commuting subsets using a greedy graph coloring method. Each group will be sampled using a single circuit.

  • “clifford”: Terms will grouped into (non-trivially) commuting subsets using a greedy graph coloring method. Each group is then co-diagonalized using a Clifford circuit and sampled. This method might add entangling gates to the circuit.

Notes

As of today, the “clifford” co-diagonalization method ignores the x_basis_change and y_basis_change arguments.

The three methods coincide when no two terms commute.

compile(batch, _specs)

Performs the splitting of all the jobs inside task.