qrisp.sbp_sub#

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

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

Parameters:
summand_1_qfQuantumFloat

The QuantumFloat to subtract from.

summand_2_qfQuantumFloat

The QuantumFloat to subtract.

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 subtraction.

Examples

We add two QuantumFloats:

from qrisp import QuantumFloat, sbp_sub
qf_0 = QuantumFloat(3)
qf_1 = QuantumFloat(3)
qf_0[:] = 3
qf_1[:] = 4
qf_res = sbp_sub(qf_0, qf_1)
print(qf_res)
# Yields: {-1: 1.0}