MCPcopy Create free account
hub / github.com/ElementsProject/elements / poly_monic

Function poly_monic

src/minisketch/tests/pyminisketch.py:191–195  ·  view source on GitHub ↗

Return a monic version of the polynomial poly.

(poly, gf)

Source from the content-addressed store, hash-verified

189# * [2, 0, 5] = 5*x^2 + 2
190
191def poly_monic(poly, gf):
192 """Return a monic version of the polynomial poly."""
193 # Multiply every coefficient with the inverse of the top coefficient.
194 inv = gf.inv(poly[-1])
195 return [gf.mul(inv, v) for v in poly]
196
197def poly_divmod(poly, mod, gf):
198 """Return the polynomial (quotient, remainder) of poly divided by mod."""

Callers 3

poly_gcdFunction · 0.85
poly_find_rootsFunction · 0.85
rec_splitFunction · 0.85

Calls 2

invMethod · 0.80
mulMethod · 0.45

Tested by

no test coverage detected