qrisp.sbp_add#

sbp_add(summand_1_qf, summand_2_qf, output_qf=None)[source]#

Performs addition based on the evaluation of semi-boolean polynomials.

Parameters:
summand_1_qfQuantumFloat

The first summand to add.

summand_2_qfQuantumFloat

The second summand to add.

output_qfQuantumFloat, optional

The QuantumFloat to store the result in. By default, a suited new QuantumFloat is created.

Returns:
output_qfQuantumFloat

A QuantumFloat containing the result of the addition.

Examples

We add two QuantumFloats:

   from qrisp import QuantumFloat, sbp_add
   qf_0 = QuantumFloat(3)
   qf_1 = QuantumFloat(3)
   qf_0[:] = 3
   qf_1[:] = 4
   qf_res = sbp_add(qf_0, qf_1)
   print(qf_res)

::

   # Yields: {7: 1.0}