Skip to content

Factored Elements

In many applications in number theory related to the multiplicative structure of number fields, interesting elements, e.g. units, are extremely large when written wrt. to a fxied basis for the field: for the fundamental unit in it is known that the coefficients wrt. the canonical basis can have many digits. All currently known, fast methods construct those elements as power products of smaller elements, allowing the computer to handle them.

Mathematically, one can think of factored elements to formally live in the ring the group ring of the non-zero field elements. Thus elements are of the form where are elements in , typically small and the are frequently large exponents. We refer to the as the base and the as the exponents of the factored element.

Since is, in general, no PID, this presentation is non-unique, elements in this form can easily be multiplied, raised to large powers, but in general not compared and not added.

In Hecke, this is caputured more generally by the type FacElem, parametrized by the type of the elements in the base and the type of their parent.

Important special cases are

  • FacElem{fmpz, FlintIntegerRing}, factored integers
  • FacElem{nf_elem, AnticNumberField}, factored algerbaic numbers
  • FacElem{NfAbsOrdIdl, NfAbsOrdIdlSet}, factored ideals

It should be noted that an object of type ` will, in general, not represent an integer as the exponents can be negative.

Construction

In general one can define factored elements by giving 2 arrays, the base and the exponent, or a dictionary containing the pairs:

# FacElem — Type.

FacElem{B}(R, base::Vector{B}, exp::Vector{fmpz}) -> FacElem{B}

Returns the element , un-expanded.

source

FacElem{B}(base::Vector{B}, exp::Vector{fmpz}) -> FacElem{B}

Returns the element , un-expanded.

source

FacElem{B}(R, d::Dict{B, fmpz}) -> FacElem{B}
FacElem{B}(R, d::Dict{B, Integer}) -> FacElem{B}

Returns the element , un-expanded.

source

FacElem{B}(d::Dict{B, fmpz}) -> FacElem{B}
FacElem{B}(d::Dict{B, Integer}) -> FacElem{B}

Returns the element , un-expanded.

source

# FacElem — Method.

FacElem{B}(R, base::Vector{B}, exp::Vector{fmpz}) -> FacElem{B}

Returns the element , un-expanded.

source

FacElem{B}(base::Vector{B}, exp::Vector{fmpz}) -> FacElem{B}

Returns the element , un-expanded.

source

FacElem{B}(R, d::Dict{B, fmpz}) -> FacElem{B}
FacElem{B}(R, d::Dict{B, Integer}) -> FacElem{B}

Returns the element , un-expanded.

source

FacElem{B}(d::Dict{B, fmpz}) -> FacElem{B}
FacElem{B}(d::Dict{B, Integer}) -> FacElem{B}

Returns the element , un-expanded.

source

# ideal — Method.

 ideal(O::NfOrd, a::FacElem{nf_elem, AnticNumberField)

The factored fractional ideal .

source

Conversion

The process of computing the value defined by a factored element is available as evaluate. Depending on the types involved this can be very efficient.

# evaluate — Method.

evaluate{T}(x::FacElem{T}) -> T

Expands or evaluates the factored element, i.e. actually computes the value. Does "square-and-multiply" on the exponent vectors.

source

# evaluate — Method.

evaluate(x::FacElem{fmpq}) -> fmpq
evaluate(x::FacElem{fmpz}) -> fmpz

Expands or evaluates the factored element, i.e. actually computes the the element. Works by first obtaining a simplified version of the power product into coprime base elements.

source

# evaluate — Method.

evaluate{T}(x::FacElem{T}) -> T

Expands or evaluates the factored element, i.e. actually computes the value. Does "square-and-multiply" on the exponent vectors.

source

# evaluate_naive — Method.

evaluate_naive{T}(x::FacElem{T}) -> T

Expands or evaluates the factored element, i.e. actually computes the value. Uses the obvious naive algorithm. Faster for input in finite rings.

source

Special functions

In the case where the parent of the base allows for efficient gcd computation, power products can be made unique:

# simplify — Method.

simplify(x::FacElem{NfOrdIdl, NfOrdIdlSet}) -> FacElem
simplify(x::FacElem{NfOrdFracIdl, NfOrdFracIdlSet}) -> FacElem

Uses coprime_base to obtain a simplified version of , ie. in the simplified version all base ideals will be pariwise coprime but not neccessarily prime!.

source

# simplify — Method.

simplify(x::FacElem{fmpq}) -> FacElem{fmpq}
simplify(x::FacElem{fmpz}) -> FacElem{fmpz}

Simplfies the factored element, i.e. arranges for the base to be coprime.

source

The simplified version can then be used further:

# isone — Method.

isone(x::FacElem{fmpq}) -> Bool
isone(x::FacElem{fmpz}) -> Bool

Tests if represents without an evaluation.

source

# factor_coprime — Method.

factor_coprime(x::FacElem{fmpz}) -> Fac{fmpz}

Computed a partial factorisation of , ie. writes as a product of pariwise coprime integers.

source

# factor_coprime — Method.

factor_coprime(x::FacElem{NfOrdIdl, NfOrdIdlSet}) -> Dict{NfOrdIdl, Int}

Computed a partial factorisation of , ie. writes as a product of pariwise coprime integral ideals.

source

# factor_coprime — Method.

factor_coprime(Q::FacElem{NfOrdFracIdl, NfOrdFracIdlSet}) -> Dict{NfOrdIdl, Int}

A coprime factorisation of : each ideal in is split using \code{integral_split} and then a coprime basis is computed. This does {\bf not} use any factorisation.

source

# factor_coprime — Method.

factor_coprime(a::FacElem{nf_elem, AnticNumberField}, I::NfOrdIdlSet) -> Dict{NfOrdIdl, fmpz}

Factors the rincipal ideal generated by into coprimes by computing a coprime basis from the principal ideals in the factorisation of .

source

# factor — Method.

 factor(Q::FacElem{NfOrdFracIdl, NfOrdFracIdlSet}) -> Dict{NfOrdIdl, Int}

The factorisation of , by refining a coprime factorisation.

source

# factor — Method.

factor(a::FacElem{nf_elem, AnticNumberField}, I::NfOrdIdlSet) -> Dict{NfOrdIdl, fmpz}

Factors the principal ideal generated by by refinind a coprime factorisation.

source

For factorised algebraic numbers a unique simplification is not possible, however, this allows still do obtain partial results:

# compact_presentation — Function.

compact_presentation(a::FacElem{nf_elem, AnticNumberField}, n::Int = 2; decom, arb_prec = 100, short_prec = 1000) -> FacElem

Computes a presentation where all the exponents are powers of and, the elements are "small", generically, they have a norm bounded by where is the discriminant of the maximal order. As the algorithm needs the factorisation of the principal ideal generated by , it can be passed in in \code{decom}.

source

# valuation — Method.

valuation(a::FacElem{nf_elem, AnticNumberField}, P::NfOrdIdl) -> fmpz

The valuation of at .

source

# valuation — Method.

valuation(A::FacElem{NfOrdFracIdl, NfOrdFracIdlSet}, p::NfOrdIdl)
valuation(A::FacElem{NfOrdIdl, NfOrdIdlSet}, p::NfOrdIdl)

The valuation of at .

source

# evaluate_mod — Method.

evaluate_mod(a::FacElem{nf_elem, AnticNumberField}, B::NfOrdFracIdl) -> nf_elem

Evaluates using CRT and small primes. Assumes that the ideal generated by is in fact . Useful in cases where has huge exponents, but the evaluated element is actually "small".

source

# reduce_ideal — Method.

reduce_ideal(A::FacElem{NfOrdIdl}) -> NfOrdIdl, FacElem{nf_elem}

Computes and in factored form, such that .

source

# modular_proj — Method.

modular_proj(a::FacElem{nf_elem, AnticNumberField}, me::modular_env) -> Vector{fq_nmod}

Given an algebraic number in factored form and data \code{me} as computed by \code{modular_init}, project onto the residue class fields.

source

Positivity & Signs

Factored elements can be used instead of number field elements for the functions sign, signs, is_positive, is_negative and is_totally_positive, see Positivity & Signs

Miscellaneous

# max_exp — Method.

max_exp(a::FacElem)

Finds the largest exponent in the factored element .

source

# min_exp — Method.

min_exp(a::FacElem)

Finds the smallest exponent in the factored element .

source

# maxabs_exp — Method.

maxabs_exp(a::FacElem)

Finds the largest exponent by absolute value in the factored element .

source