qadic.h – unramified extensions over p-adic numbers¶
Data structures¶
We represent an element of the extension
qadic_struct
and qadic_t
are
typedef’ed as padic_poly_struct
and padic_poly_t
.
Context¶
We represent an unramified extension of pctx
, which contains data about
the prime len
, where
var
contains the name of a generator
of the extension, which is used when printing the
elements.
-
void qadic_ctx_init(qadic_ctx_t ctx, const fmpz_t p, slong d, slong min, slong max, const char *var, enum padic_print_mode mode)¶
Initialises the context
ctx
with prime , extension degree , variable namevar
and printing modemode
. The defining polynomial is chosen as a Conway polynomial if possible and otherwise as a random sparse polynomial.Stores powers of
with exponents betweenmin
(inclusive) andmax
exclusive. Assumes thatmin
is at mostmax
.Assumes that
is a prime.Assumes that the string
var
is a null-terminated string of length at least one.Assumes that the printing mode is one of
PADIC_TERSE
,PADIC_SERIES
, orPADIC_VAL_UNIT
.This function also carries out some relevant precomputation for arithmetic in
such as powers of close to .
-
void qadic_ctx_init_conway(qadic_ctx_t ctx, const fmpz_t p, slong d, slong min, slong max, const char *var, enum padic_print_mode mode)¶
Initialises the context
ctx
with prime , extension degree , variable namevar
and printing modemode
. The defining polynomial is chosen as a Conway polynomial, hence has restrictions on the prime and the degree.Stores powers of
with exponents betweenmin
(inclusive) andmax
exclusive. Assumes thatmin
is at mostmax
.Assumes that
is a prime.Assumes that the string
var
is a null-terminated string of length at least one.Assumes that the printing mode is one of
PADIC_TERSE
,PADIC_SERIES
, orPADIC_VAL_UNIT
.This function also carries out some relevant precomputation for arithmetic in
such as powers of close to .
-
void qadic_ctx_clear(qadic_ctx_t ctx)¶
Clears all memory that has been allocated as part of the context.
-
void qadic_ctx_print(const qadic_ctx_t ctx)¶
Prints the data from the given context.
Memory management¶
-
void qadic_init(qadic_t rop)¶
Initialises the element
rop
, setting its value to .
-
void qadic_init2(qadic_t rop, slong prec)¶
Initialises the element
rop
with the given output precision, setting the value to .
-
void qadic_clear(qadic_t rop)¶
Clears the element
rop
.
-
void _fmpz_poly_reduce(fmpz *R, slong lenR, const fmpz *a, const slong *j, slong len)¶
Reduces a polynomial
(R, lenR)
modulo a sparse monic polynomial of degree at least .Assumes that the array
of positive lengthlen
is sorted in ascending order.Allows zero-padding in
(R, lenR)
.
-
void _fmpz_mod_poly_reduce(fmpz *R, slong lenR, const fmpz *a, const slong *j, slong len, const fmpz_t p)¶
Reduces a polynomial
(R, lenR)
modulo a sparse monic polynomial of degree at least in , where is typically a prime power.Assumes that the array
of positive lengthlen
is sorted in ascending order.Allows zero-padding in
(R, lenR)
.
-
void qadic_reduce(qadic_t rop, const qadic_ctx_t ctx)¶
Reduces
rop
modulo and .
Properties¶
Randomisation¶
-
void qadic_randtest(qadic_t rop, flint_rand_t state, const qadic_ctx_t ctx)¶
Generates a random element of
.
-
void qadic_randtest_not_zero(qadic_t rop, flint_rand_t state, const qadic_ctx_t ctx)¶
Generates a random non-zero element of
.
-
void qadic_randtest_val(qadic_t rop, flint_rand_t state, slong v, const qadic_ctx_t ctx)¶
Generates a random element of
with prescribed valuationval
.Note that if
then the element is necessarily zero.
-
void qadic_randtest_int(qadic_t rop, flint_rand_t state, const qadic_ctx_t ctx)¶
Generates a random element of
with non-negative valuation.
Assignments and conversions¶
-
void qadic_set(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Sets
rop
toop
.
-
void qadic_zero(qadic_t rop)¶
Sets
rop
to zero.
-
void qadic_one(qadic_t rop)¶
Sets
rop
to one, reduced in the given context.Note that if the precision
is non-positive thenrop
is actually set to zero.
-
void qadic_gen(qadic_t rop, const qadic_ctx_t ctx)¶
Sets
rop
to the generator for the extension when , and zero otherwise. If the extension degree is one, raises an abort signal.
-
void qadic_set_ui(qadic_t rop, ulong op, const qadic_ctx_t ctx)¶
Sets
rop
to the integerop
, reduced in the context.
-
int qadic_get_padic(padic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
If the element
op
lies in , setsrop
to its value and returns ; otherwise, returns .
Comparison¶
-
int qadic_is_zero(const qadic_t op)¶
Returns whether
op
is equal to zero.
-
int qadic_is_one(const qadic_t op)¶
Returns whether
op
is equal to one in the given context.
-
int qadic_equal(const qadic_t op1, const qadic_t op2)¶
Returns whether
op1
andop2
are equal.
Basic arithmetic¶
-
void qadic_add(qadic_t rop, const qadic_t op1, const qadic_t op2, const qadic_ctx_t ctx)¶
Sets
rop
to the sum ofop1
andop2
.Assumes that both
op1
andop2
are reduced in the given context and ensures thatrop
is, too.
-
void qadic_sub(qadic_t rop, const qadic_t op1, const qadic_t op2, const qadic_ctx_t ctx)¶
Sets
rop
to the difference ofop1
andop2
.Assumes that both
op1
andop2
are reduced in the given context and ensures thatrop
is, too.
-
void qadic_neg(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Sets
rop
to the negative ofop
.Assumes that
op
is reduced in the given context and ensures thatrop
is, too.
-
void qadic_mul(qadic_t rop, const qadic_t op1, const qadic_t op2, const qadic_ctx_t ctx)¶
Sets
rop
to the product ofop1
andop2
, reducing the output in the given context.
-
void _qadic_inv(fmpz *rop, const fmpz *op, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N)¶
Sets
(rop, d)
to the inverse of(op, len)
modulo given by(a,j,lena)
and .Assumes that
(op,len)
has valuation , that is, that it represents a -adic unit.Assumes that
len
is at most .Does not support aliasing.
-
void qadic_inv(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Sets
rop
to the inverse ofop
, reduced in the given context.
-
void _qadic_pow(fmpz *rop, const fmpz *op, slong len, const fmpz_t e, const fmpz *a, const slong *j, slong lena, const fmpz_t p)¶
Sets
(rop, 2*d-1)
to(op,len)
raised to the power , reduced modulo given by(a, j, lena)
and , which is expected to be a prime power.Assumes that
and thatlen
is positive and at most .Although we require that
rop
provides space for coefficients, the output will be reduced modulo , which is a polynomial of degree .Does not support aliasing.
Square root¶
-
int qadic_sqrt(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Return
1
if the input is a square (to input precision). If so, setrop
to a square root (truncated to output precision).
Special functions¶
-
void _qadic_exp_rectangular(fmpz *rop, const fmpz *op, slong v, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N, const fmpz_t pN)¶
Sets
(rop, 2*d - 1)
to the exponential of(op, v, len)
reduced modulo , assuming that the series converges.Assumes that
(op, v, len)
is non-zero.Does not support aliasing.
-
int qadic_exp_rectangular(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Returns whether the exponential series converges at
op
and setsrop
to its value reduced modulo in the given context.
-
void _qadic_exp_balanced(fmpz *rop, const fmpz *x, slong v, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N, const fmpz_t pN)¶
Sets
(rop, d)
to the exponential of(op, v, len)
reduced modulo , assuming that the series converges.Assumes that
len
is in but supports zero padding, including the special case when(op, len)
is zero.Supports aliasing between
rop
andop
.
-
int qadic_exp_balanced(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Returns whether the exponential series converges at
op
and setsrop
to its value reduced modulo in the given context.
-
void _qadic_exp(fmpz *rop, const fmpz *op, slong v, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N, const fmpz_t pN)¶
Sets
(rop, 2*d - 1)
to the exponential of(op, v, len)
reduced modulo , assuming that the series converges.Assumes that
(op, v, len)
is non-zero.Does not support aliasing.
-
int qadic_exp(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Returns whether the exponential series converges at
op
and setsrop
to its value reduced modulo in the given context.The exponential series converges if the valuation of
op
is at least or when is even or odd, respectively.
-
void _qadic_log_rectangular(fmpz *z, const fmpz *y, slong v, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N, const fmpz_t pN)¶
Computes
Note that this can be used to compute the
-adic logarithm via the equationAssumes that
is non-zero and that is at least when is odd and at least when so that the series converges.Assumes that
is reduced modulo .Assumes that
, and in particular .Supports aliasing between
and .
-
int qadic_log_rectangular(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Returns whether the
-adic logarithm function converges atop
, and if so setsrop
to its value.
-
void _qadic_log_balanced(fmpz *z, const fmpz *y, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N, const fmpz_t pN)¶
Computes
asAssumes that
is at least when is odd and at least when so that the series converges.Supports aliasing between
and .
-
int qadic_log_balanced(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Returns whether the
-adic logarithm function converges atop
, and if so setsrop
to its value.
-
void _qadic_log(fmpz *z, const fmpz *y, slong v, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N, const fmpz_t pN)¶
Computes
asNote that this can be used to compute the
-adic logarithm via the equationAssumes that
is non-zero and that is at least when is odd and at least when so that the series converges.Assumes that
is reduced modulo .Assumes that
, and hence in particular .Supports aliasing between
and .
-
int qadic_log(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Returns whether the
-adic logarithm function converges atop
, and if so setsrop
to its value.The
-adic logarithm function is defined by the usual seriesbut this only converges when
is at least or when or , respectively.
-
void _qadic_frobenius_a(fmpz *rop, slong e, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N)¶
Computes
where is such that .Assumes that the precision
is at least and that the extension is non-trivial, i.e. .Assumes that
.Sets
(rop, 2*d-1)
, although the actual length of the output will be at most .
-
void _qadic_frobenius(fmpz *rop, const fmpz *op, slong len, slong e, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N)¶
Sets
(rop, 2*d-1)
to evaluated at(op, len)
.Assumes that
len
is positive but at most .Assumes that
.Does not support aliasing.
-
void qadic_frobenius(qadic_t rop, const qadic_t op, slong e, const qadic_ctx_t ctx)¶
Evaluates the homomorphism
atop
.Recall that
is Galois with Galois group , which is also isomorphic to , where is the Frobenius element and is its lift to .This functionality is implemented as
GaloisImage()
in Magma.
-
void _qadic_teichmuller(fmpz *rop, const fmpz *op, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N)¶
Sets
(rop, d)
to the Teichmüller lift of(op, len)
modulo .Does not support aliasing.
-
void qadic_teichmuller(qadic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Sets
rop
to the Teichmüller lift ofop
to the precision given in the context.For a unit
op
, this is the unique th root of unity which is congruent toop
modulo .Sets
rop
to zero ifop
is zero in the given context.Raises an exception if the valuation of
op
is negative.
-
void _qadic_trace(fmpz_t rop, const fmpz *op, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t pN)¶
-
void qadic_trace(padic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Sets
rop
to the trace ofop
.For an element
, multiplication by defines a -linear map on . We define the trace of as the trace of this map. Equivalently, if generates then the trace of is equal to .
-
void _qadic_norm(fmpz_t rop, const fmpz *op, slong len, const fmpz *a, const slong *j, slong lena, const fmpz_t p, slong N)¶
Sets
rop
to the norm of the element(op,len)
in to precision , wherelen
is at least one.The result will be reduced modulo
.Note that whenever
(op,len)
is a unit, so is its norm. Thus, the outputrop
of this function will typically not have to be canonicalised or reduced by the caller.
-
void qadic_norm(padic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Computes the norm of
op
to the given precision.Algorithm selection is automatic depending on the input.
-
void qadic_norm_analytic(padic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Whenever
op
has valuation greater than , this routine computes its normrop
viaIn the special case that
op
lies in , returns its norm as , where is the extension degree.Otherwise, raises an
abort
signal.The complexity of this implementation is quasi-linear in
and , and polynomial in .
-
void qadic_norm_resultant(padic_t rop, const qadic_t op, const qadic_ctx_t ctx)¶
Sets
rop
to the norm ofop
, using the formulawhere
, is the leading coefficient of , and denotes the same polynomial as .The complexity of the current implementation is given by
, where denotes the complexity of multiplying to -bit integers.
Output¶
-
int qadic_fprint_pretty(FILE *file, const qadic_t op, const qadic_ctx_t ctx)¶
Prints a pretty representation of
op
tofile
.In the current implementation, always returns
. The return code is part of the function’s signature to allow for a later implementation to return the number of characters printed or a non-positive error code.
-
int qadic_print_pretty(const qadic_t op, const qadic_ctx_t ctx)¶
Prints a pretty representation of
op
tostdout
.In the current implementation, always returns
. The return code is part of the function’s signature to allow for a later implementation to return the number of characters printed or a non-positive error code.