renf.h — Real Embedded Number Fields#
This header defines one of the basic objects of e-antic, renf_t a real embedded number field and the functions that interact with it.
Memory Layout#
-
typedef renf renf_t[1]#
A real embedded number field.
Actually, this is an array of renf of length one.
Typically, users of e-antic should not worry about the exact definition of this and just treat this as the type that represents a number field in e-antic.
Note
Using an array of length one instead of a plain
renfor arenf*is a common trick in C which is probably best known from MPFR and GMP but also used in the FLINT library that we build upon. Essentially, this gives much better semantics than a plainrenf. E.g., arenf_tis not assignable. (Directly assigning arenfto anotherrenfdoes not do what one would expect as the heap-allocated parts of arenfare not duplicated correctly.) Also, calling a function that accepts arenf_tpasses the value with reference semantics, as if it were arenf*, i.e., without copying the underlying value. Since arenf_tis always stack allocated and cannot be returned from a function, it is also much harder to produce dangling pointers which one would get when usingrenf*everywhere instead.
-
struct renf#
Internal representation of a real embedded number field.
The attributes are not part of the API and should be accessed directly. The exact structure here is only of interest for those who want to work on e-antic itself. To interact with a real embedded number field, use the
renf_functions described below.Typical users of e-antic will never instantiate a
renfdirectly but instead work with a renf_t.Public Members
-
nf_t nf#
An algebraic number field, provided by FLINT (formerly ANTIC.)
-
fmpz_poly_t der#
The derivative of the defining polynomial (without denominator) as a FLINT polynomial over the integers.
-
slong prec#
Precision (number of bits) used for binary operations on enclosures.
-
arb_t emb#
The real embedding of the generator of this number field, given as ball in the reals.
-
int immutable#
A flag used during refinements to ensure thread-safety.
-
nf_t nf#
Initialization, Allocation, Deallocation#
-
void renf_init(renf_t nf, fmpq_poly_t pol, arb_t emb, slong prec)#
Set
nfto be the real embedded number field define by the minimal polynomialpoland the (approximate) embeddingemb. The parameterprecis used as the default precision for binary operations on enclosures.
-
void renf_init_nth_root_fmpq(renf_t nf, fmpq_t d, ulong n, slong prec)#
Set
nfto be the real embedded number field defined as then-th root of the rational numberd.precis the default precision.
Other Functions#
-
void renf_refine_embedding(renf_t nf, slong prec)#
Refine the embedding of
nftoprecbits of precision.
-
int renf_set_immutable(renf_t nf, int immutable)#
Change the mutability of the number field. If
immutableis zero, make the number field mutable. Otherwise, make the number field immutable. Returns the previous value. It is not possible to refine the embedding of an immutable number field. This method is used internally as a sanity-check in multi-threaded code.
-
int renf_equal(const renf_t nf1, const renf_t nf2)#
Return whether the two number fields are equal. Two embedded number field are considered equal if they define the same subfield of the real numbers. The precision of the embedding or the precision of bit operations do not matter in this comparison.
-
void renf_randtest(renf_t nf, flint_rand_t state, slong len, slong prec, mp_bitcnt_t bits)#
Set
nfto a random number field. Used internally in unit tests.