@@ -67,34 +67,11 @@ def yield_(
6767 def for_loop (
6868 self , interp : FidelityAnalysis , frame : interp .Frame [EmptyLattice ], stmt : For
6969 ):
70-
7170 if not isinstance (hint := stmt .iterable .hints .get ("const" ), const .Value ):
7271 # NOTE: not clear how long this loop is
7372 # TODO: should we at least count the body once?
7473 return
7574
76- current_gate_fidelity = interp ._current_gate_fidelity
77- current_atom_survival = interp ._current_atom_survival_probability
78-
79- # NOTE: we reset the interpreter fidelity and evaluate the fidelity for the body only once
80- interp ._current_gate_fidelity = 1.0
81- interp ._current_atom_survival_probability = 1.0
82- for s in stmt .body .stmts ():
83- stmt_impl = interp .lookup_registry (frame = frame , stmt = s )
84- if stmt_impl is None :
85- continue
86-
87- stmt_impl (interp = interp , frame = frame , stmt = s )
88-
89- loop_body_gate_fidelity = interp ._current_gate_fidelity
90- loop_body_atom_survival = interp ._current_atom_survival_probability
91-
92- # NOTE: reset current fidelity now in case of 0 iterations
93- interp ._current_gate_fidelity = current_gate_fidelity
94- interp ._current_atom_survival_probability = current_atom_survival
95-
96- # NOTE: now we simply decrease the fidelity according to the number of iterations
97- iterable = hint .data
98- for _ in iterable :
99- interp ._current_gate_fidelity *= loop_body_gate_fidelity
100- interp ._current_atom_survival_probability *= loop_body_atom_survival
75+ for _ in hint .data :
76+ for s in stmt .body .stmts ():
77+ interp .eval_stmt (frame = frame , stmt = s )
0 commit comments