qit.gate.mod_add¶
- qit.gate.mod_add(dim1, dim2, N=None)¶
Modular adder gate.
- Parameters
dim1 (tuple[int]) – control register dimensions
dim2 (tuple[int]) – target register dimensions
N (int) – cutoff dimension, default is
prod(dim2)
- Returns
modular adder gate U
- Return type
\[U: \ket{x, y} \mapsto \ket{x, y+x (\mod N)}\]If N is given we must have
N <= prod(dim2)
, and U will act trivially on target states>= N
.Notes
The modular subtractor gate can be obtained by taking the Hermitian conjugate of
mod_add
.mod_add(2, 2)
is equal to CNOT.