mqt.yaqs.characterization.memory.backends.exact

Exact Hamiltonian probing via sequence simulation with diagnostics.

Module Contents

class ExactBackend(*, operator: MPO, sim_params: AnalogSimParams, initial_psi: ndarray, parallel: bool = True, show_progress: bool = False, solver: StochasticSolver | None = None, _execution: mqt.yaqs.core.parallel_utils.ExecutionConfig | None = None)[source]

Exact MCWF/TJM backend for weighted split-cut probe evaluation.

Builds a reusable static MCWF context internally and dispatches sequence simulation via simulate_sequences() with record_diagnostics=True.

operator
sim_params
initial_psi
property parallel: bool

Whether parallel sequence execution is enabled.

execution_config(*, parallel: bool | None = None) mqt.yaqs.core.parallel_utils.ExecutionConfig[source]

Return execution settings, optionally overriding parallelism for one call.

Parameters:

parallel – When set, merge a one-shot parallel override into the backend config.

Returns:

Effective ExecutionConfig.

evaluate_probes_weighted(probe_set: ProbeSet, *, intervention_steps_list: list[list[Any]] | None = None, _execution: mqt.yaqs.core.parallel_utils.ExecutionConfig | None = None) tuple[ndarray, ndarray][source]

Evaluate weighted probe responses via exact simulation.

Parameters:
  • probe_set – Sampled split-cut probes.

  • intervention_steps_list – Optional pre-built sequence grid (experiment geometries).

  • _execution – Optional one-shot execution override for this evaluation.

Returns:

Tuple (pauli_xyz_ij, weights_ij).

evaluate_probes(probe_set: ProbeSet) ndarray[source]

Evaluate unweighted Pauli probe responses.

Parameters:

probe_set – Sampled split-cut probes.

Returns:

Array of shape (n_pasts, n_futures, 4).

simulate_exact(*, probe_set: ProbeSet, operator: MPO, sim_params: AnalogSimParams, initial_psi: ndarray, parallel: bool = True, show_progress: bool = False, solver: StochasticSolver | None = None, _execution: mqt.yaqs.core.parallel_utils.ExecutionConfig | None = None, intervention_steps_list: list[list[Any]] | None = None, static_ctx: MCWFContext | None = None) tuple[ndarray, ndarray, list[dict[str, Any]]][source]

Exact simulation with per-sequence diagnostics (branch weights, early termination).

Parameters:
  • probe_set – Sampled split-cut probes.

  • operator – Hamiltonian MPO.

  • sim_params – Analog simulation parameters.

  • initial_psi – Initial state vector for sequences.

  • parallel – Whether to parallelize sequence simulation.

  • show_progress – Whether to show a progress bar.

  • solver – Stochastic solver ("MCWF" or "TJM").

  • _execution – Optional internal execution configuration.

  • intervention_steps_list – Optional pre-built sequence grid (experiment geometries).

  • static_ctx – Optional reusable MCWF static context (built when omitted for MCWF).

Returns:

(pauli_ij, weights_ij, simulation_diagnostics) where pauli_ij has shape (n_pasts, n_futures, 4), weights_ij holds break weights through cut c, and simulation_diagnostics[i * n_f + j] matches the sequence order of the grid.

Raises:

TypeError – If the backend output is not an ndarray.