MCPcopy Create free account
hub / github.com/ShahjalalShohag/code-library / inv

Method inv

Math/Thomas Algorithm.cpp:19–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 inline modint<MOD> operator - () const { return modint<MOD>(this->value ? MOD - this->value : 0); }
18 modint<MOD> pow(uint64_t k) const { modint<MOD> x = *this, y = 1; for (; k; k >>= 1) { if (k & 1) y *= x; x *= x; } return y; }
19 modint<MOD> inv() const { return pow(MOD - 2); } // MOD must be a prime
20 inline modint<MOD> operator / (modint<MOD> other) const { return *this * other.inv(); }
21 inline modint<MOD> operator /= (modint<MOD> other) { return *this *= other.inv(); }
22 inline bool operator == (modint<MOD> other) const { return value == other.value; }

Callers 3

operator /Method · 0.45
operator /=Method · 0.45
ThomasFunction · 0.45

Calls 1

powFunction · 0.70

Tested by

no test coverage detected