Skip to main content

infer_feedback

Function infer_feedback 

Source
pub fn infer_feedback(
    qasm: &str,
    graph: &BlockGraph,
) -> Result<Vec<Action>, FeedbackInferenceError>
Expand description

Derives additional Pauli feedback for an existing realization.

Existing actions remain in force. The returned actions are checked on a clone before return; the input graph is unchanged. Use infer_feedback_with for explicit wire/record/resource correspondence.

This checks every bounded named branch and every certified anonymous boundary class in the logical ZX model. Discarded outcomes are summed as CP maps, compared up to a branch scalar using QuiZX’s dyadic arithmetic. Choi arithmetic and projective cross-products are checked using i128 dyadic coefficients. Earlier QuiZX simplification/contraction still uses floating-point coefficients: this is numerical logical verification, not an unrestricted exact-arithmetic certificate. Relative probabilities between named branches and noisy physical execution require separate verification. It does not infer missing Resolve choices or promise a polynomial algorithm for arbitrary non-Clifford maps.

use bloq_graph::{Action, GalleryItem, infer_feedback};
let mut graph = GalleryItem::S.build().materialize_root_graph().expect("gallery flat projection");
graph.set_actions(graph.actions().into_iter()
    .filter(|action| !matches!(action, Action::Feedback { .. })).collect())?;
let mut actions = graph.actions();
actions.extend(infer_feedback("OPENQASM 2.0; qreg q[1]; s q;", &graph)?);
graph.set_actions(actions)?;

§Errors

Returns parsing, binding, support, resource-limit, or verification errors.