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

Function MakeMonic

src/minisketch/src/sketch_impl.h:62–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60/** Make a polynomial monic. */
61template<typename F>
62typename F::Elem MakeMonic(std::vector<typename F::Elem>& a, const F& field) {
63 CHECK_SAFE(a.back() != 0);
64 if (a.back() == 1) return 0;
65 auto inv = field.Inv(a.back());
66 typename F::Multiplier mul(field, inv);
67 a.back() = 1;
68 for (size_t i = 0; i < a.size() - 1; ++i) {
69 a[i] = mul(a[i]);
70 }
71 return inv;
72}
73
74/** Compute the GCD of two polynomials, putting the result in a. b will be cleared. */
75template<typename F>

Callers 2

GCDFunction · 0.85
RecFindRootsFunction · 0.85

Calls 3

mulFunction · 0.85
InvMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected