qrisp.QuantumFloat.sb_poly#

QuantumFloat.sb_poly(m: int = 0) Expr[source]#

Returns the semi-boolean polynomial of this QuantumFloat where m specifies the image extension parameter.

For the technical details we refer to: https://ieeexplore.ieee.org/document/9815035

Parameters:
mint, optional

Image extension parameter. The default is 0.

Returns:
Sympy expression

The semi-boolean polynomial of this QuantumFloat.

Examples

The polynomial’s symbols are named after this QuantumFloat’s hash (to guarantee uniqueness across QuantumFloats), so we inspect its coefficients rather than its literal string representation:

>>> from qrisp import QuantumFloat
>>> import sympy as sp
>>> x = QuantumFloat(3, -1, signed = True, name = "x")
>>> [float(c) for c in sp.Poly(x.sb_poly(5)).coeffs()]
[0.5, 1.0, 2.0, 28.0]