@@ -364,30 +364,31 @@ def t_cor(
364364 Applies active corrections of errors diagnozed by the measurement for gate teleportation.
365365 """
366366 warn ("Using experimental feature: t_cor" , stacklevel = 2 )
367- flag = flag or self .scratch .elems [7 ]
368- return Block (
367+ block = Block (
369368 # gate teleportation without logical correction
370369 aux .prep_t_plus_state (reject = reject , rus_limit = rus_limit ),
371370 self .cx (aux ),
372371 aux .mz (self .t_meas ),
373372 # active error correction
374373 self .syn_z .set (aux .syn_meas ),
375- If (self .syn_z != 0 ).Then (flag .set (1 )),
376374 self .last_raw_syn_z .set (0 ),
377375 self .pf_x .set (0 ),
378376 FlagLookupQASMActiveCorrectionZ (
379377 self .d ,
380378 self .syn_z ,
381- self .syndromes ,
379+ self .syn_z ,
382380 self .last_raw_syn_z ,
383381 self .pf_x ,
384- flag ,
382+ self . syn_z ,
385383 self .syn_z ,
386384 self .scratch ,
387385 ),
388386 # logical correction
389387 If (self .t_meas == 1 ).Then (self .sz ()),
390388 )
389+ if flag is not None :
390+ block .extend (If (self .syn_z != 0 ).Then (flag .set (1 )))
391+ return block
391392
392393 def tdg_cor (
393394 self ,
@@ -401,30 +402,31 @@ def tdg_cor(
401402 Applies active corrections of errors diagnozed by the measurement for gate teleportation.
402403 """
403404 warn ("Using experimental feature: t_cor" , stacklevel = 2 )
404- flag = flag or self .scratch .elems [7 ]
405- return Block (
405+ block = Block (
406406 # gate teleportation without logical correction
407407 aux .prep_tdg_plus_state (reject = reject , rus_limit = rus_limit ),
408408 self .cx (aux ),
409409 aux .mz (self .tdg_meas ),
410410 # active error correction
411411 self .syn_z .set (aux .syn_meas ),
412- If (self .syn_z != 0 ).Then (flag .set (1 )),
413412 self .last_raw_syn_z .set (0 ),
414413 self .pf_x .set (0 ),
415414 FlagLookupQASMActiveCorrectionZ (
416415 self .d ,
417416 self .syn_z ,
418- self .syndromes ,
417+ self .syn_z ,
419418 self .last_raw_syn_z ,
420419 self .pf_x ,
421- flag ,
420+ self . syn_z ,
422421 self .syn_z ,
423422 self .scratch ,
424423 ),
425424 # logical correction
426425 If (self .tdg_meas == 1 ).Then (self .szdg ()),
427426 )
427+ if flag is not None :
428+ block .extend (If (self .syn_z != 0 ).Then (flag .set (1 )))
429+ return block
428430
429431 # End Experimental: ------------------------------------
430432
0 commit comments