3#ifndef _aring_gf_flint_big_hpp_
4#define _aring_gf_flint_big_hpp_
48#include <M2/gc-include.h>
51#include <M2/math-include.h>
53#pragma GCC diagnostic push
54#pragma GCC diagnostic ignored "-Wconversion"
55#include <flint/flint.h>
56#include <flint/fmpz.h>
57#include <flint/fq_nmod.h>
58#include <flint/nmod_poly.h>
59#pragma GCC diagnostic pop
151 std::unique_ptr<ElementType[]>
mData;
201 unsigned int hash = 0;
202 long deg = nmod_poly_degree(&a);
203 for (
long i = 0; i <= deg; i++)
204 hash +=
static_cast<unsigned int>(nmod_poly_get_coeff_ui(&a, i)) *
215 size_t coeffs_size =
sizeof(mp_limb_t)*b->alloc;
216 mp_ptr coeffs =
reinterpret_cast<mp_ptr
>(
getmem_atomic(coeffs_size));
217 memcpy(coeffs,b->coeffs,coeffs_size);
218 flint_free(b->coeffs);
237 return fq_nmod_is_zero(&f,
mContext);
241 return fq_nmod_equal(&f, &g,
mContext);
244 int compare_elems(
const ElementType& f,
const ElementType& g)
const;
269 std::vector<long> poly = {0, 1};
351 printf(
"entering divide\n");
384 if (mpz_sgn(n) < 0 and
is_zero(a))
399 fmpz_init_set_readonly(
fn, abs_n);
401 fmpz_clear_readonly(
fn);
412 const ElementType& a,
415 bool p_parens =
false)
const;
439 const std::vector<long>& poly)
const;
442 std::vector<long>& poly)
const;
455 const ElementType& f,
Shared base of the aring framework (namespace M2) that unifies the engine's coefficient rings.
Append-only GC-backed byte buffer used throughout the engine for text output.
Element(const ARingGFFlintBig &R, const ElementType &value)
const fq_nmod_ctx_struct * mContext
Element(const ARingGFFlintBig &R)
const ElementType & operator[](size_t idx) const
const ElementType * data() const
ElementType & operator[](size_t idx)
const fq_nmod_ctx_struct * mContext
ElementArray(const ARingGFFlintBig &R, size_t size)
std::unique_ptr< ElementType[]> mData
const PolynomialRing & originalRing() const
void fromSmallIntegerCoefficients(ElementType &result, const std::vector< long > &poly) const
void getGenerator(ElementType &result_gen) const
const PolynomialRing & mOriginalRing
bool lift(const Ring *Rg, const ElementType &f, ring_elem &result) const
void negate(ElementType &result, const ElementType &a) const
const fq_nmod_ctx_struct * flintContext() const
ElementType mCachedGenerator
void syzygy(const ElementType &a, const ElementType &b, ElementType &x, ElementType &y) const
void from_ring_elem(ElementType &result, const ring_elem &a) const
void subtract_multiple(ElementType &result, const ElementType &a, const ElementType &b) const
const ElementType & from_ring_elem_const(const ring_elem &a) const
const RingElement * mPrimitiveElement
void power(ElementType &result, const ElementType &a, int n) const
void set_from_mpz(ElementType &result, mpz_srcptr a) const
void divide(ElementType &result, const ElementType &a, const ElementType &b) const
std::vector< elem > ElementContainerType
void set_var(ElementType &result, int v) const
void clear(ElementType &result) const
static const RingID ringID
bool is_equal(const ElementType &f, const ElementType &g) const
void lift_to_original_ring(ring_elem &result, const ElementType &f) const
bool is_zero(const ElementType &f) const
ARingGFFlintBig(const PolynomialRing &R, const ring_elem a)
bool promote(const Ring *Rf, const ring_elem f, ElementType &result) const
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
void init_set(ElementType &result, const ElementType &a) const
void invert(ElementType &result, const ElementType &a) const
void set(ElementType &result, const ElementType &a) const
void set_zero(ElementType &result) const
flint_rand_t mRandomState
void add(ElementType &result, const ElementType &a, const ElementType &b) const
void text_out(buffer &o) const
long characteristic() const
bool set_from_BigReal(ElementType &result, gmp_RR a) const
bool set_from_mpq(ElementType &result, mpq_srcptr a) const
void to_ring_elem(ring_elem &result, const ElementType &a) const
fq_nmod_struct ElementType
void power_mpz(ElementType &result, const ElementType &a, mpz_srcptr n) const
void elem_text_out(buffer &o, const ElementType &a, bool p_one=true, bool p_plus=false, bool p_parens=false) const
void getSmallIntegerCoefficients(const ElementType &a, std::vector< long > &poly) const
void swap(ElementType &a, ElementType &b) const
unsigned int computeHashValue(const elem &a) const
Arithmetic functions ///////.
void random(ElementType &result) const
int compare_elems(const ElementType &f, const ElementType &g) const
void init(ElementType &result) const
void mult(ElementType &result, const ElementType &a, const ElementType &b) const
void eval(const RingMap *map, const ElementType &f, int first_var, ring_elem &result) const
void set_from_long(ElementType &result, long a) const
void copy(ElementType &result, const ElementType &a) const
bool is_unit(const ElementType &f) const
const ElementType & value() const
Abstract base for the engine's polynomial-ring hierarchy.
Front-end-visible "ring element" value: an engine ring_elem paired with the Ring* that gives it meani...
Engine-side ring homomorphism: stores, for each source-ring variable, the target-ring element it maps...
namespace exc — internal C++ exception types and the TRY / CATCH macro pair.
static CanonicalForm base
char * getmem_atomic(size_t n)
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define getmemstructtype(S)
ring_elem — the universal value type carried by every Ring* in the engine.
Singly linked-list node carrying one term of a polynomial-ring element.