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 usingaas it performs allocation. Once done withathe 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
aandb
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 integernan element in the number fieldnf.
-
void renf_elem_set_ui(renf_elem_t a, ulong n, const renf_t nf)#
Set
ato the integernas an element in the number fieldnf.
-
void renf_elem_set(renf_elem_t a, const renf_elem_t b, const renf_t nf)#
Set
ato the number field elementbwhich is defined in the number fieldnf.
-
void renf_elem_set_fmpz(renf_elem_t a, const fmpz_t c, const renf_t nf)#
Set
ato the integercas an element in the number fieldnf.
-
void renf_elem_set_mpz(renf_elem_t a, const mpz_t c, const renf_t nf)#
Set
ato the integercas an element in the number fieldnf.
-
void renf_elem_set_fmpq(renf_elem_t a, const fmpq_t c, const renf_t nf)#
Set
ato the rationalcas an element in the number fieldnf.
-
void renf_elem_set_mpq(renf_elem_t a, const mpq_t c, const renf_t nf)#
Set
ato the rationalcas an element in the number fieldnf.
-
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 fieldnf.
-
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 elementbdefined in exact number field underlyingnf. Then refineato precisionprec.
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 ofnf. Computation is done at precisionprec. 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 is1ifais positive,0ifais zero and-1ifais negative.
-
void renf_elem_floor(fmpz_t a, renf_elem_t b, renf_t nf)#
Set
ato be the floor ofb
-
void renf_elem_ceil(fmpz_t a, renf_elem_t b, renf_t nf)#
Set
ato be the ceil ofb
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 elementathat belongs to the number fieldnfwithprecbits 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 elementsaandbbehave as follows. They returna positive integer if
ais greater thanb,0ifaandbare equal, anda negative integer if
ais smaller thanb.
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 namevar. The resulting string needs to be freed withflint_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 innf.
Unary operations#
-
void renf_elem_neg(renf_elem_t a, const renf_elem_t b, const renf_t nf)#
Set
ato the negative ofb.
-
void renf_elem_inv(renf_elem_t a, const renf_elem_t b, const renf_t nf)#
Set
ato the inverse ofb.
Binary operations#
- group renf_elem_binop
All the binary operation functions are of the form
renf_elem_OP_TYP(a, b, c, nf)whereOPis the operation typeTYPis the type of the argumentcais the argument used for returned valuebandcare the operandsnfis the parent number field of the operation In short, these functions performa = 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
bandcand set the result ina. 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 then-th first partial quotients of the continued fraction of the elementaofnf.
-
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 evaluatingaas a polynomial in the number field generator.