Return a monic version of the polynomial poly.
(poly, gf)
| 189 | # * [2, 0, 5] = 5*x^2 + 2 |
| 190 | |
| 191 | def 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 | |
| 197 | def poly_divmod(poly, mod, gf): |
| 198 | """Return the polynomial (quotient, remainder) of poly divided by mod.""" |
no test coverage detected