mod_add_const

Function mod_add_const 

Source
pub fn mod_add_const(
    b: &[usize],
    overflow: usize,
    a_const: usize,
    n_const: usize,
) -> U
Expand description

A quantum circuit that adds constants and multiplies modular operations using constants, and stores the result in one input bit.

|b⟩|overflow:0⟩ → |a+b mod N⟩|0⟩

  • overflow = |0⟩.
  • a, N: const.
  • N < 2^(n+1).
  • a, b < N.
  • b.len() == n.

Required number of qubits: n(b) + 1(overflow) = n + 1