@@ -30,13 +30,9 @@ def cv(self) -> Optional[int]:
30
30
def with_cv (self , * , cv : Optional [int ]) -> 'Bloq' :
31
31
...
32
32
33
- @property
34
- def ctrl_reg_name (self ) -> str :
35
- ...
36
-
37
33
38
34
def get_ctrl_system_for_bloq_with_specialized_single_qubit_control (
39
- bloq : 'BloqWithSpecializedControl' , ctrl_spec : 'CtrlSpec'
35
+ bloq : 'BloqWithSpecializedControl' , ctrl_spec : 'CtrlSpec' , * , ctrl_reg_name : str = 'ctrl'
40
36
) -> tuple ['Bloq' , 'AddControlledT' ]:
41
37
from qualtran import Bloq , CtrlSpec , Soquet
42
38
from qualtran .bloqs .mcmt import ControlledViaAnd
@@ -57,8 +53,12 @@ def _adder(
57
53
bb : 'BloqBuilder' , ctrl_soqs : Sequence ['SoquetT' ], in_soqs : dict [str , 'SoquetT' ]
58
54
) -> tuple [Iterable ['SoquetT' ], Iterable ['SoquetT' ]]:
59
55
(ctrl ,) = ctrl_soqs
60
- ctrl , * out_soqs = bb .add_t (ctrl_bloq , ctrl = ctrl , ** in_soqs )
61
- return [ctrl ], out_soqs
56
+ in_soqs |= {ctrl_reg_name : ctrl }
57
+
58
+ out_soqs = bb .add_d (ctrl_bloq , ** in_soqs )
59
+
60
+ ctrl = out_soqs .pop (ctrl_reg_name )
61
+ return [ctrl ], out_soqs .values ()
62
62
63
63
else :
64
64
# the difficult case: must combine the two controls into one
0 commit comments