inquanto-phayes

InQuanto Phayes extension.

class AlgorithmBayesianQPE(phayes_state, k_max=None, error_rate=None, verbose=0)

Execute Bayesian QPE algorithm.

This class reproduces the workflow in arXiv:2306.16608.

The Bayesian update part is based on the Quantinuum’s phayes package.

Parameters:
  • phayes_state (PhayesState) – Initial state as a PhayesState object.

  • k_max (Optional[int], default: None) – Cap of the number of repeats of the CTRL-U circuit.

  • error_rate (Optional[Callable[[int, float], float]], default: None) – Error rate to be used for the noise-aware likelihood.

  • verbose (int, default: 0) – Control the verbosity.

build(protocol)

Set the IQPE protocol object.

Parameters:

protocol (BaseIterativePhaseEstimation) – IQPE protocol to be used for handling the circuit.

Returns:

AlgorithmBayesianQPE – self

final_pdf(phi)

Return the PDF as a function of phase.

Parameters:

phi (ndarray) – Grid representation of the phase in [0, 2) (pytket convention).

Returns:

ndarray – Probability distribution function.

final_value()

Return the energy estimate.

Returns:

tuple[float, float] – Mean and the square root of the Holevo variance.

property has_updated: bool

Indicate if the Bayesian update is performed or not.

It returns False if no measurement outcome is available for some reasons such as discarding the measurement outcome by the error detection code. Repeat until success is effectively performed by calling run() again.

Returns:

True if the Bayesian update is performed.

join(handles_mapping)

Retrieve the backend results through the protocol.

Parameters:

handles_mapping (List[Tuple[int, float, ResultHandle]]) – List of job IDs (\(k\), \(\beta\), result handles).

property phayes_state: PhayesState

Current PhaseState object.

run()

Run the algorithm.

run_async()

Run the jobs asynchnonously.

Returns:

List[Tuple[int, float, List[ResultHandle]]] – List of job IDs (\(k\), \(\beta\), result handles).