qrisp.fourier_adder#

fourier_adder(a, b, perform_QFT=True)[source]#

In-place adder function based on this paper Performs the addition

b += a
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.

perform_QFTbool, optional

If set to False, no QFT is executed. The default is True.

Examples

We add two integers:

>>> from qrisp import QuantumFloat, fourier_adder
>>> a = QuantumFloat(4)
>>> b = QuantumFloat(4)
>>> a[:] = 4
>>> b[:] = 5
>>> fourier_adder(a,b)
>>> print(b)
{9: 1.0}