Macaulay2 Engine
Loading...
Searching...
No Matches

◆ power_mpz()

void M2::ARingGFM2::power_mpz ( elem & result,
elem a,
mpz_srcptr n ) const
inline

Definition at line 353 of file aring-m2-gf.hpp.

354 {
355 if (a != 0)
356 {
357 long n1 = mpz_fdiv_ui(n, mGF.orderMinusOne());
358 power(result, a, n1);
359 }
360 else
361 {
362 // a is the zero element
363 if (mpz_sgn(n) > 0)
364 result = 0;
365 else if (mpz_sgn(n) == 0)
366 result = mGF.one();
367 else
368 throw exc::division_by_zero_error();
369 }
370 }
void power(elem &result, elem a, long n) const
GaloisFieldTable mGF
VALGRIND_MAKE_MEM_DEFINED & result(result)

References mGF, power(), and result().