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

◆ power_mpz()

void M2::ARingGFFlintBig::power_mpz ( ElementType & result,
const ElementType & a,
mpz_srcptr n ) const
inline

Definition at line 382 of file aring-gf-flint-big.hpp.

383 {
384 if (mpz_sgn(n) < 0 and is_zero(a))
385 throw exc::division_by_zero_error();
386
388 init(base);
389 if (mpz_sgn(n) < 0)
390 invert(base, a);
391 else
392 copy(base, a);
393
394 mpz_t abs_n;
395 mpz_init(abs_n);
396 mpz_abs(abs_n, n);
397
398 fmpz_t fn;
399 fmpz_init_set_readonly(fn, abs_n);
400 fq_nmod_pow(&result, &base, fn, mContext);
401 fmpz_clear_readonly(fn);
402 mpz_clear(abs_n);
403 clear(base);
404 }
void clear(ElementType &result) const
bool is_zero(const ElementType &f) const
void invert(ElementType &result, const ElementType &a) const
void init(ElementType &result) const
void copy(ElementType &result, const ElementType &a) const
static CanonicalForm base
Definition factory.cpp:289
OrigFn fn
Definition m2-mem.cpp:273
VALGRIND_MAKE_MEM_DEFINED & result(result)

References base, clear(), copy(), fn, init(), invert(), is_zero(), mContext, and result().