1717
1818import numpy as np
1919from attrs import evolve , field , frozen
20+ from numpy .typing import NDArray
2021
2122from qualtran import (
2223 Bloq ,
@@ -107,7 +108,7 @@ def short_name(self) -> str:
107108 def build_call_graph (self , ssa : 'SympySymbolAllocator' ) -> Set ['BloqCountT' ]:
108109 if self .is_adjoint :
109110 # inverting inequality tests at zero Toffoli.
110- return {}
111+ return set ()
111112 else :
112113 return {(Toffoli (), 6 * self .num_bits_t + 2 )}
113114
@@ -147,6 +148,7 @@ def wire_symbol(self, soq: 'Soquet') -> 'WireSymbol':
147148 (c_idx ,) = soq .idx
148149 filled = bool (self .cvs [c_idx ])
149150 return Circle (filled )
151+ raise ValueError (f'Unknown name: { soq .reg .name } ' )
150152
151153 def build_composite_bloq (
152154 self , bb : BloqBuilder , ctrl : SoquetT , sel : SoquetT , targets : SoquetT , junk : SoquetT
@@ -294,9 +296,9 @@ def build_composite_bloq(
294296 r : SoquetT ,
295297 s : SoquetT ,
296298 mu : SoquetT ,
297- nu_x : SoquetT ,
298- nu_y : SoquetT ,
299- nu_z : SoquetT ,
299+ nu_x : Soquet ,
300+ nu_y : Soquet ,
301+ nu_z : Soquet ,
300302 m : SoquetT ,
301303 succ_nu : SoquetT ,
302304 l : SoquetT ,
@@ -462,7 +464,7 @@ def short_name(self) -> str:
462464 def build_composite_bloq (
463465 self ,
464466 bb : BloqBuilder ,
465- ham_ctrl : SoquetT ,
467+ ham_ctrl : NDArray [ Soquet ], # type: ignore[type-var]
466468 i_ne_j : SoquetT ,
467469 plus_t : SoquetT ,
468470 i : SoquetT ,
@@ -478,7 +480,7 @@ def build_composite_bloq(
478480 m : SoquetT ,
479481 l : SoquetT ,
480482 sys : SoquetT ,
481- proj : SoquetT ,
483+ proj : NDArray [ Soquet ], # type: ignore[type-var]
482484 ) -> Dict [str , 'SoquetT' ]:
483485 # ancilla for swaps from electronic and projectile system registers.
484486 # we assume these are left in a clean state after SELECT operations
@@ -543,8 +545,10 @@ def build_composite_bloq(
543545 j , sys , q = bb .add (
544546 MultiplexedCSwap3D (self .num_bits_p , self .eta ), sel = j , targets = sys , junk = q
545547 )
546- _ = [bb .free (pi ) for pi in p ]
547- _ = [bb .free (qi ) for qi in q ]
548+ for pi in p :
549+ bb .free (pi )
550+ for qi in q :
551+ bb .free (qi )
548552 ham_ctrl [:] = flag_t , flag_t_mean , flag_uv , flag_proj
549553 bb .free (rl )
550554 return {
0 commit comments