| 269 | } |
| 270 | |
| 271 | template <class T> T AbstractEuclideanDomain<T>::Gcd(const Element &a, const Element &b) const |
| 272 | { |
| 273 | Element g[3]={b, a}; |
| 274 | unsigned int i0=0, i1=1, i2=2; |
| 275 | |
| 276 | while (!this->Equal(g[i1], this->Zero())) |
| 277 | { |
| 278 | g[i2] = Mod(g[i0], g[i1]); |
| 279 | unsigned int t = i0; i0 = i1; i1 = i2; i2 = t; |
| 280 | } |
| 281 | |
| 282 | return g[i0]; |
| 283 | } |
| 284 | |
| 285 | template <class T> typename QuotientRing<T>::Element QuotientRing<T>::MultiplicativeInverse(const typename T::Element &a) const |
| 286 | { |