|
12 | 12 | # See the License for the specific language governing permissions and
|
13 | 13 | # limitations under the License.
|
14 | 14 |
|
15 |
| -from typing import Iterable, Optional, Sequence, Tuple, Union, List, Iterator |
16 |
| -from numpy.typing import NDArray |
| 15 | +from typing import Iterable, Iterator, List, Optional, Sequence, Tuple, Union |
17 | 16 |
|
18 |
| -from cirq._compat import cached_property |
19 | 17 | import attr
|
20 | 18 | import cirq
|
| 19 | +from cirq._compat import cached_property |
| 20 | +from numpy.typing import NDArray |
| 21 | + |
21 | 22 | from cirq_ft import infra
|
22 | 23 | from cirq_ft.algos import and_gate
|
23 | 24 |
|
@@ -142,13 +143,25 @@ class BiQubitsMixer(infra.GateWithRegisters):
|
142 | 143 | y = 2*y_msb + y_lsb
|
143 | 144 | The Gate mixes the 4 qubits so that sign(x - y) = sign(x_lsb' - y_lsb') where x_lsb' and y_lsb'
|
144 | 145 | are the final values of x_lsb' and y_lsb'.
|
| 146 | +
|
| 147 | + Note that the ancilla qubits are used to reduce the T-count and the user |
| 148 | + should clean the qubits at a later point in time with the adjoint gate. |
| 149 | + See: https://github.com/quantumlib/Cirq/pull/6313 and |
| 150 | + https://github.com/quantumlib/Qualtran/issues/389 |
145 | 151 | """ # pylint: disable=line-too-long
|
146 | 152 |
|
147 | 153 | adjoint: bool = False
|
148 | 154 |
|
149 | 155 | @cached_property
|
150 | 156 | def signature(self) -> infra.Signature:
|
151 |
| - return infra.Signature.build(x=2, y=2, ancilla=3) |
| 157 | + one_side = infra.Side.RIGHT if not self.adjoint else infra.Side.LEFT |
| 158 | + return infra.Signature( |
| 159 | + [ |
| 160 | + infra.Register('x', 2), |
| 161 | + infra.Register('y', 2), |
| 162 | + infra.Register('ancilla', 3, side=one_side), |
| 163 | + ] |
| 164 | + ) |
152 | 165 |
|
153 | 166 | def __repr__(self) -> str:
|
154 | 167 | return f'cirq_ft.algos.BiQubitsMixer({self.adjoint})'
|
|
0 commit comments