MCPcopy Create free account
hub / github.com/JeanLucPons/VanitySearch / ModInv

Method ModInv

IntGroup.cpp:36–58  ·  view source on GitHub ↗

Compute modular inversion of the whole group

Source from the content-addressed store, hash-verified

34
35// Compute modular inversion of the whole group
36void IntGroup::ModInv() {
37
38 Int newValue;
39 Int inverse;
40
41 subp[0].Set(&ints[0]);
42 for (int i = 1; i < size; i++) {
43 subp[i].ModMulK1(&subp[i - 1], &ints[i]);
44 }
45
46 // Do the inversion
47 inverse.Set(&subp[size - 1]);
48 inverse.ModInv();
49
50 for (int i = size - 1; i > 0; i--) {
51 newValue.ModMulK1(&subp[i - 1], &inverse);
52 inverse.ModMulK1(&ints[i]);
53 ints[i].Set(&newValue);
54 }
55
56 ints[0].Set(&inverse);
57
58}

Callers

nothing calls this directly

Calls 2

ModMulK1Method · 0.80
SetMethod · 0.45

Tested by

no test coverage detected