qrisp.gidney_adder#

gidney_adder(qf2, qf1, *args, ignore_rounding_error=False, ignore_overflow_error=True, **kwargs)#

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.

c_inQubit, optional

An optional carry in value. The default is None.

c_outQubit, optional

An optional carry out value. The default is None.

Examples

We add two integers:

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