qrisp.remaud_adder#
- remaud_adder(a, b, z)[source]#
In-place adder function based on this paper, Algorithm 3. Performs the addition:
b += a
with a polylogarithmic depth and no use of auxiliary qubits. Both a and b should have the same size N and the result of the overflow is stored in the carry Qubit.
- Parameters:
- aint or QuantumVariable or list[Qubit]
The value that should be added.
- bQuantumVariable or list[Qubit]
The value that should be modified in the in-place addition.
- zQubit
The carry value resulting from the overflow of the addition.
Examples
We add two integers:
>>> from qrisp import QuantumFloat, remaud_adder >>> a = QuantumFloat(4) >>> b = QuantumFloat(4) >>> z = QuantumFloat(1) >>> a[:] = 4 >>> b[:] = 5 >>> remaud_adder(a,b,z) >>> print(b) {9: 1.0}