renf_elem.h — Embedded Number Field Elements#
Memory Layout#
- 
typedef renf_elem renf_elem_t[1]#
- An element of a real embedded number field. - Actually, this is an array of renf_elem 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 element in e-antic. - See the documentation of renf_t for why this is an array. 
- 
struct renf_elem#
- A real embedded number field element. - Public Members - 
nf_elem_t elem#
- An algebraic - ANTIC number field element.
 
- 
nf_elem_t elem#
- 
void renf_elem_init(renf_elem_t a, const renf_t nf)#
- Initialize the number field element - a. This function has to be called prior to any code using- aas it performs allocation. Once done with- athe memory must be freed with [renf_elem_clear]().
- 
void renf_elem_clear(renf_elem_t a, const renf_t nf)#
- Deallocate the memory for - athat was allocated with [renf_elem_init]().
- 
static inline void renf_elem_swap(renf_elem_t a, renf_elem_t b)#
- Swap the number field elements - aand- b
Setters#
- 
void renf_elem_zero(renf_elem_t a, const renf_t nf)#
- Set the number field element - ato zero.
- 
void renf_elem_one(renf_elem_t a, const renf_t nf)#
- Set the number field element - ato one.
- 
void renf_elem_gen(renf_elem_t a, const renf_t nf)#
- Set the number field element - ato the generator of the number field.
- 
void renf_elem_set_si(renf_elem_t a, slong n, const renf_t nf)#
- Set - ato the integer- nan element in the number field- nf.
- 
void renf_elem_set_ui(renf_elem_t a, ulong n, const renf_t nf)#
- Set - ato the integer- nas an element in the number field- nf.
- 
void renf_elem_set(renf_elem_t a, const renf_elem_t b, const renf_t nf)#
- Set - ato the number field element- bwhich is defined in the number field- nf.
- 
void renf_elem_set_fmpz(renf_elem_t a, const fmpz_t c, const renf_t nf)#
- Set - ato the integer- cas an element in the number field- nf.
- 
void renf_elem_set_mpz(renf_elem_t a, const mpz_t c, const renf_t nf)#
- Set - ato the integer- cas an element in the number field- nf.
- 
void renf_elem_set_fmpq(renf_elem_t a, const fmpq_t c, const renf_t nf)#
- Set - ato the rational- cas an element in the number field- nf.
- 
void renf_elem_set_mpq(renf_elem_t a, const mpq_t c, const renf_t nf)#
- Set - ato the rational- cas an element in the number field- nf.
- 
void renf_elem_set_fmpq_poly(renf_elem_t a, const fmpq_poly_t pol, const renf_t nf)#
- Set - ato provided integer/rational as an element in the number field- nf.
- 
void renf_elem_set_nf_elem(renf_elem_t a, const nf_elem_t b, renf_t nf, slong prec)#
- Set - ato the number field element- bdefined in exact number field underlying- nf. Then refine- ato precision- prec.
Embedding Refinement#
- 
void renf_elem_set_evaluation(renf_elem_t a, const renf_t nf, slong prec)#
- Set the enclosure of the number field element - ausing the enclosure of the generator of- nf. Computation is done at precision- prec. This function does not make any refinement of the number field generator. For that purpose see [renf_refine_embedding]().
Properties and Conversion#
- 
int renf_elem_is_zero(const renf_elem_t a, const renf_t nf)#
- Return 1 if - ais equal to zero and 0 otherwise.
- 
int renf_elem_is_one(const renf_elem_t a, const renf_t nf)#
- Return 1 if - ais equal to one and 0 otherwise.
- 
int renf_elem_is_integer(const renf_elem_t a, const renf_t nf)#
- Return 1 if - ais integral and 0 otherwise.
- 
int renf_elem_is_rational(const renf_elem_t a, const renf_t nf)#
- Return 1 if - ais rational and 0 otherwise.
- 
int renf_elem_sgn(renf_elem_t a, renf_t nf)#
- Return the sign of - a. It is- 1if- ais positive,- 0if- ais zero and- -1if- ais negative.
- 
void renf_elem_floor(fmpz_t a, renf_elem_t b, renf_t nf)#
- Set - ato be the floor of- b
- 
void renf_elem_ceil(fmpz_t a, renf_elem_t b, renf_t nf)#
- Set - ato be the ceil of- b
Floating point approximations#
- 
void renf_elem_get_arb(arb_t x, renf_elem_t a, renf_t nf, slong prec)#
- Set - xto a a real ball enclosing the element- athat belongs to the number field- nfwith- precbits of precision.
- 
double renf_elem_get_d(renf_elem_t a, renf_t nf, arf_rnd_t rnd)#
- Return a double approximation. 
Comparisons#
- group renf_elem_cmp
- All the comparison functions - renf_elem_cmp_…between two elements- aand- bbehave as follows. They return- a positive integer if - ais greater than- b,
- 0if- aand- bare equal, and
- a negative integer if - ais smaller than- b.
 - If you want to check for equality, use the faster - renf_elem_equal_…functions.- Functions - 
int renf_elem_cmp(renf_elem_t a, renf_elem_t b, renf_t nf)#
 - 
int _renf_elem_cmp_fmpq(renf_elem_t a, fmpz *num, fmpz *den, renf_t nf)#
 - 
int renf_elem_cmp_fmpq(renf_elem_t a, const fmpq_t b, renf_t nf)#
 - 
int renf_elem_cmp_fmpz(renf_elem_t a, const fmpz_t b, renf_t nf)#
 - 
int renf_elem_cmp_si(renf_elem_t a, const slong b, renf_t nf)#
 - 
int renf_elem_cmp_ui(renf_elem_t a, const ulong b, renf_t nf)#
 - 
int renf_elem_equal(const renf_elem_t a, const renf_elem_t b, const renf_t nf)#
 - 
int renf_elem_equal_si(const renf_elem_t a, const slong b, const renf_t nf)#
 - 
int renf_elem_equal_ui(const renf_elem_t a, const ulong b, const renf_t nf)#
 - 
int renf_elem_equal_fmpz(const renf_elem_t a, const fmpz_t b, const renf_t nf)#
 - 
int renf_elem_equal_fmpq(const renf_elem_t a, const fmpq_t b, const renf_t nf)#
 
String Conversion and Printing#
- 
char *renf_elem_get_str_pretty(renf_elem_t a, const char *var, renf_t nf, slong n, int flag)#
- Return - aas a string with variable name- var. The resulting string needs to be freed with- flint_free.
- 
void renf_elem_print_pretty(renf_elem_t a, const char *var, renf_t nf, slong n, int flag)#
- Write - ato the standard output.
Randomization#
- 
void renf_elem_randtest(renf_elem_t a, flint_rand_t state, mp_bitcnt_t bits, renf_t nf)#
- Set - ato a random element in- nf.
Unary operations#
- 
void renf_elem_neg(renf_elem_t a, const renf_elem_t b, const renf_t nf)#
- Set - ato the negative of- b.
- 
void renf_elem_inv(renf_elem_t a, const renf_elem_t b, const renf_t nf)#
- Set - ato the inverse of- b.
Binary operations#
- group renf_elem_binop
- All the binary operation functions are of the form - renf_elem_OP_TYP(a, b, c, nf)where- OPis the operation type
- TYPis the type of the argument- c
- ais the argument used for returned value
- band- care the operands
- nfis the parent number field of the operation In short, these functions perform- a = b OP c.
 - Functions - 
void renf_elem_add_si(renf_elem_t a, const renf_elem_t b, slong c, const renf_t nf)#
 - 
void renf_elem_sub_si(renf_elem_t a, const renf_elem_t b, slong c, const renf_t nf)#
 - 
void renf_elem_mul_si(renf_elem_t a, const renf_elem_t b, slong c, const renf_t nf)#
 - 
void renf_elem_div_si(renf_elem_t a, const renf_elem_t b, slong c, const renf_t nf)#
 - 
void renf_elem_add_ui(renf_elem_t a, const renf_elem_t b, ulong c, const renf_t nf)#
 - 
void renf_elem_sub_ui(renf_elem_t a, const renf_elem_t b, ulong c, const renf_t nf)#
 - 
void renf_elem_mul_ui(renf_elem_t a, const renf_elem_t b, ulong c, const renf_t nf)#
 - 
void renf_elem_div_ui(renf_elem_t a, const renf_elem_t b, ulong c, const renf_t nf)#
 - 
void renf_elem_add_fmpz(renf_elem_t a, const renf_elem_t b, const fmpz_t c, const renf_t nf)#
 - 
void renf_elem_sub_fmpz(renf_elem_t a, const renf_elem_t b, const fmpz_t c, const renf_t nf)#
 - 
void renf_elem_mul_fmpz(renf_elem_t a, const renf_elem_t b, const fmpz_t c, const renf_t nf)#
 - 
void renf_elem_div_fmpz(renf_elem_t a, const renf_elem_t b, const fmpz_t c, const renf_t nf)#
 - 
void renf_elem_add_fmpq(renf_elem_t a, const renf_elem_t b, const fmpq_t c, const renf_t nf)#
 - 
void renf_elem_sub_fmpq(renf_elem_t a, const renf_elem_t b, const fmpq_t c, const renf_t nf)#
 - 
void renf_elem_fmpq_sub(renf_elem_t a, const fmpq_t c, const renf_elem_t b, const renf_t nf)#
 - 
void renf_elem_mul_fmpq(renf_elem_t a, const renf_elem_t b, const fmpq_t c, const renf_t nf)#
 - 
void renf_elem_div_fmpq(renf_elem_t a, const renf_elem_t b, const fmpq_t c, const renf_t nf)#
 - 
void renf_elem_fmpq_div(renf_elem_t a, const fmpq_t b, const renf_elem_t c, const renf_t nf)#
 - 
void renf_elem_add(renf_elem_t a, const renf_elem_t b, const renf_elem_t c, const renf_t nf)#
 - 
void renf_elem_sub(renf_elem_t a, const renf_elem_t b, const renf_elem_t c, const renf_t nf)#
 - 
void renf_elem_mul(renf_elem_t a, const renf_elem_t b, const renf_elem_t c, const renf_t nf)#
 - 
void renf_elem_div(renf_elem_t a, const renf_elem_t b, const renf_elem_t c, const renf_t nf)#
 - 
void renf_elem_pow(renf_elem_t res, const renf_elem_t a, ulong e, const renf_t nf)#
 
- 
void renf_elem_fdiv(fmpz_t a, renf_elem_t b, renf_elem_t c, renf_t nf)#
- Perform the floor division of the number field elements - band- cand set the result in- a. The result is equivalent to a call of [renf_elem_div] followed by [renf_elem_floor]. This function is much faster, though.
Other functions#
- 
slong renf_elem_get_cfrac(fmpz *c, renf_elem_t rem, renf_elem_t a, slong n, renf_t nf)#
- Set the array - cto the- n-th first partial quotients of the continued fraction of the element- aof- nf.
- 
void renf_elem_check_embedding(const renf_elem_t a, const renf_t nf, slong prec)#
- Check that the embedding is consistent. 
- 
int renf_elem_relative_condition_number_2exp(slong *cond, renf_elem_t a, renf_t nf)#
- Logarithm of the condition number of - a. The return value corresponds to the number of bits of precision that will be lost when evaluating- aas a polynomial in the number field generator.