qit.gate.mod_mul

qit.gate.mod_mul(x, dim, N=None)

Modular multiplication gate.

Parameters
  • x (int) – multiplier

  • dim (tuple[int]) – register dimensions

  • N (int) – cutoff dimension, default is prod(dim)

Returns

modular multiplication gate U

Return type

Lmap

\[U: \ket{y} \mapsto \ket{x*y (mod N)}\]

x and N must be coprime for the operation to be reversible.

If N is given, we must have N <= prod(dim), and U will act trivially on computational states >= N.