78 return static_cast<unsigned int>(a);
95 if (cmp < 0)
return -1;
96 if (cmp > 0)
return 1;
136 result =
static_cast<double>(a);
158 result = mpfr_get_d(a, MPFR_RNDN);
243 const ElementType &a,
246 bool p_parens =
false)
const;
280 ERROR(
"cannot map double to ring type");
286 if (mpfr_cmp_d(epsilon, fabs(a)) > 0)
set_zero(a);
292 if (mpfr_cmp_d(norm, d) < 0) mpfr_set_d(norm, d, MPFR_RNDN);
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.
void init(ElementType &result) const
void set_zero(ElementType &result) const
bool set_from_mpq(ElementType &result, mpq_srcptr a) const
void to_ring_elem(ring_elem &result, const ElementType &a) const
int compare_elems(const ElementType &f, const ElementType &g) const
ElementType from_ring_elem_const(const ring_elem &a) const
void mult(ElementType &result, const ElementType &a, const ElementType &b) const
void init_set(ElementType &result, const ElementType &a) const
void divide(ElementType &result, const ElementType &a, const ElementType &b) const
void copy(ElementType &result, const ElementType &a) const
bool is_zero(const ElementType &f) const
void text_out(buffer &o) const
void swap(ElementType &a, ElementType &b) const
double coerceToDouble(const ElementType &a) const
void elem_text_out(buffer &o, const ElementType &a, bool p_one=true, bool p_plus=false, bool p_parens=false) const
void negate(ElementType &result, const ElementType &a) const
bool set_from_BigReal(ElementType &result, gmp_RR a) const
bool is_unit(const ElementType &f) const
void set(ElementType &result, const ElementType &a) const
size_t characteristic() const
void increase_norm(mpfr_ptr norm, const ElementType &a) const
bool set_from_double(ElementType &result, double a) const
void subtract_multiple(ElementType &result, const ElementType &a, const ElementType &b) const
static void clear(ElementType &result)
unsigned long get_precision() const
void abs(ElementType &result, const ElementType &a) const
void set_var(ElementType &result, int v) const
void power(ElementType &result, const ElementType &a, int n) const
void from_ring_elem(ElementType &result, const ring_elem &a) const
unsigned int computeHashValue(const elem &a) const
void set_from_long(ElementType &result, long a) const
void abs_squared(ElementType &result, const ElementType &a) const
void power_mpz(ElementType &result, const ElementType &a, mpz_srcptr n) const
void invert(ElementType &result, const ElementType &a) const
static const RingID ringID
void add(ElementType &result, const ElementType &a, const ElementType &b) const
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
void zeroize_tiny(gmp_RR epsilon, ElementType &a) const
void addMultipleTo(ElementType &result, const ElementType &a, const ElementType &b) const
void random(ElementType &result) const
void syzygy(const ElementType &a, const ElementType &b, ElementType &x, ElementType &y) const
void eval(const RingMap *map, ElementType &f, int first_var, ring_elem &result) const
void set_from_mpz(ElementType &result, mpz_srcptr a) const
bool is_equal(const ElementType &f, const ElementType &g) const
A base class for simple ARings.
virtual ring_elem from_long(long n) const =0
virtual bool from_double(double a, ring_elem &result) const
const Ring * get_ring() const
Engine-side ring homomorphism: stores, for each source-ring variable, the target-ring element it maps...
static std::pair< bool, int > get_si(mpz_srcptr n)
namespace exc — internal C++ exception types and the TRY / CATCH macro pair.
VALGRIND_MAKE_MEM_DEFINED & result(result)
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
Engine-boundary C API for the engine's PRNG and rational / real / complex random draws.
ring_elem — the universal value type carried by every Ring* in the engine.
RingMap — engine representation of a ring homomorphism.
double get_double() const