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

Function TraceMod

src/minisketch/src/sketch_impl.h:102–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100/** Compute the trace map of (param*x) modulo mod, putting the result in out. */
101template<typename F>
102void TraceMod(const std::vector<typename F::Elem>& mod, std::vector<typename F::Elem>& out, const typename F::Elem& param, const F& field) {
103 out.reserve(mod.size() * 2);
104 out.resize(2);
105 out[0] = 0;
106 out[1] = param;
107
108 for (int i = 0; i < field.Bits() - 1; ++i) {
109 Sqr(out, field);
110 if (out.size() < 2) out.resize(2);
111 out[1] = param;
112 PolyMod(mod, out, field);
113 }
114}
115
116/** One step of the root finding algorithm; finds roots of stack[pos] and adds them to roots. Stack elements >= pos are destroyed.
117 *

Callers 1

RecFindRootsFunction · 0.85

Calls 6

SqrFunction · 0.85
PolyModFunction · 0.70
reserveMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
BitsMethod · 0.45

Tested by

no test coverage detected