qat.lang.AQASM.arithmetic.add_mod
- qat.lang.AQASM.arithmetic.add_mod(reg_size: int, modulus: int)
Builds a circuit performing an addition between two numbers modulo a constant modulus. Only the first register is updated during the addition:
\[|a \rangle |b\rangle \mapsto |a \rangle | a + b \mod modulus \rangle\]Notice that the first register is added into the second register.
- Parameters
reg_size (int) – the size of the first register
modulus (int) – the modulus
Warning
This routine has public arity reg_size but uses 2 additional qubits (these will be automatically allocated at circuit generation time, in the
to_circ()
method).This number does not include the optional qubits allocated by sub-routines used inside this routine
This routine calls:
- Any addition (E.g:
qat.lang.AQASM.qftarith.add()
or qat.lang.AQASM.classarith.add()
) with arguments (reg_size`+ 1, `reg_size )
- Any addition (E.g:
Any addition of a constant (E.g
qat.lang.AQASM.qftarith.add_const()
)