Skip to content

Commit

Permalink
nf_elem -> AbsSimpleNumFieldElem (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin authored Mar 5, 2024
1 parent 11748cc commit 827578c
Show file tree
Hide file tree
Showing 11 changed files with 343 additions and 343 deletions.
6 changes: 3 additions & 3 deletions src/Arith.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export e2p

const FracPoly{T} = Generic.UnivPoly{Generic.FracFieldElem{T}, Generic.MPoly{Generic.FracFieldElem{T}}} where T
const NfPoly = Union{PolyRingElem{QQFieldElem}, PolyRingElem{nf_elem}}
const NfPoly = Union{PolyRingElem{QQFieldElem}, PolyRingElem{AbsSimpleNumFieldElem}}

"""
normalize(a::FracPoly)
Expand All @@ -17,15 +17,15 @@ function normalize(a::QQFieldElem)
return mod(numerator(a), denominator(a))//denominator(a)
end
end
function normalize(a::nf_elem)
function normalize(a::AbsSimpleNumFieldElem)
if isone(denominator(a))
return zero(a)
else
rational_part=coeff(a,0)
return a-rational_part+normalize(rational_part)
end
end
function normalize(a::Union{QQPolyRingElem, Generic.Poly{nf_elem}})
function normalize(a::Union{QQPolyRingElem, Generic.Poly{AbsSimpleNumFieldElem}})
return parent(a)(collect(map(normalize, coefficients(a))))
end
function normalize(a::FracPoly{T}) where T <: NfPoly
Expand Down
2 changes: 1 addition & 1 deletion src/Greenfunctions/2B2/2B2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ K, sqrt2 = quadratic_field(2)
R, q = polynomial_ring(K, "q")

order = q^4*(q^2-1)*(q^4+1)
table = Generic.Poly{nf_elem}[[
table = Generic.Poly{AbsSimpleNumFieldElem}[[
q^4+1,
R(1),
R(1),
Expand Down
2 changes: 1 addition & 1 deletion src/Greenfunctions/2F4/2F4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ K, sqrt2 = quadratic_field(2)
R, q = polynomial_ring(K, "q")

order = q^24*(q^2-1)^2*(q^2+1)^2*(q^4+1)^2*(q^4-q^2+1)*(q^8-q^4+1)
table = Generic.Poly{nf_elem}[[
table = Generic.Poly{AbsSimpleNumFieldElem}[[
(q^2+1)^2*(q^4+1)^2*(q^4-q^2+1)*(q^8-q^4+1),
(q^2+1)^2*(q^4+1)*(q^4-q^2+1),
(q^2+1)*(q^8+q^6+q^4+1),
Expand Down
2 changes: 1 addition & 1 deletion src/Greenfunctions/2G2/2G2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ K, sqrt3 = quadratic_field(3)
R, q = polynomial_ring(K, "q")

order = q^6*(q^2-1)*(q^2+1)*(q^4-q^2+1)
table = Generic.Poly{nf_elem}[[
table = Generic.Poly{AbsSimpleNumFieldElem}[[
(q^2+1)*(q^4-q^2+1),
R(1),
R(1),
Expand Down
4 changes: 2 additions & 2 deletions src/Parameter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end
Return the sign of the leading coefficient of the polynomial representation of `a`.
"""
function weak_sign(a::nf_elem)
function weak_sign(a::AbsSimpleNumFieldElem)
for deg in reverse(range(1, degree(parent(a))-1))
signum=sign(coeff(a, deg))
if !iszero(signum)
Expand Down Expand Up @@ -105,7 +105,7 @@ end


isint(a::QQFieldElem) = isone(denominator(a))
function isint(a::nf_elem)
function isint(a::AbsSimpleNumFieldElem)
rational_part=coeff(a,0)
if a == rational_part
return isint(rational_part)
Expand Down
4 changes: 2 additions & 2 deletions src/PrintToTex/Factor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function rootkey(f::QQPolyRingElem)
coeff=collect(coefficients(f))
return RootKey(coeff, zeros(QQFieldElem, length(coeff)), :nothing)
end
function rootkey(f::Generic.Poly{nf_elem})
function rootkey(f::Generic.Poly{AbsSimpleNumFieldElem})
coeffs=collect(coefficients(f))
return RootKey(coeff.(coeffs,0),coeff.(coeffs,1) ,var(parent(coeffs[1])))
end
Expand Down Expand Up @@ -190,7 +190,7 @@ function ordexp(b::Generic.FracFieldElem{QQPolyRingElem})
d = lcm(denominator.(collect(coefficients(num))))
return num*d, den*d
end
function ordexp(b::Generic.FracFieldElem{Generic.Poly{nf_elem}})
function ordexp(b::Generic.FracFieldElem{Generic.Poly{AbsSimpleNumFieldElem}})
num, den = numerator(b), denominator(b)
d = lcm(denominator.(coeff.(collect(coefficients(num)),0)))
return num*d, den*d
Expand Down
2 changes: 1 addition & 1 deletion src/SumProc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export eesubs, nesum
function isunitfraction(a::QQFieldElem)
isone(numerator(a))
end
function isunitfraction(a::nf_elem)
function isunitfraction(a::AbsSimpleNumFieldElem)
rational_part=coeff(a,0)
if a == rational_part
return isunitfraction(rational_part)
Expand Down
46 changes: 23 additions & 23 deletions src/Tables/2B2/2B2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ S = UniversalPolynomialRing(Q, cached=false)
a,b,c,s,k,u, _...=gens(S, ["a", "b", "c", "s", "k", "u", "a1", "b1", "c1", "s1", "k1", "u1", "a2", "b2", "c2", "s2", "k2", "u2", "a3", "b3", "c3", "s3", "k3", "u3", "at1", "bt1", "ct1", "st1", "kt1", "ut1", "at2", "bt2", "ct2", "st2", "kt2", "ut2"])

order = q^4*(q^4+1)*(q^2-1)
table = Cyclotomic{Generic.Poly{nf_elem}}[[
table = Cyclotomic{Generic.Poly{AbsSimpleNumFieldElem}}[[
(1)*e2p(S(0)),
(1)*e2p(S(0)),
(1)*e2p(S(0)),
Expand Down Expand Up @@ -86,16 +86,16 @@ chardegree = R.([1, q*1//sqrt2*(q^2-1), q*1//sqrt2*(q^2-1), q^4, q^4+1, (q^2-1)*

classsums=[
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
s1,e1=nesum(tt, a, 1, q^2-2, congruence)
Expand All @@ -113,16 +113,16 @@ end

charsums=[
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
(tt, Set{ParameterException{Generic.Poly{nf_elem}}}())
(tt, Set{ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}}())
end,
function (tt::Cyclotomic)
s1,e1=nesum(tt, s, 1, q^2-2, congruence)
Expand All @@ -139,23 +139,23 @@ end
]

classparams=[
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters([Parameter(a, q^2-1)], [ParameterException((a)*1//(q^2-1))], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters([Parameter(b, q^2+sqrt2*q+1)], [ParameterException((b)*1//(q^2+sqrt2*q+1))], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters([Parameter(c, q^2-sqrt2*q+1)], [ParameterException((c)*1//(q^2-sqrt2*q+1))], ParameterSubstitution{Generic.Poly{nf_elem}}[])
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters([Parameter(a, q^2-1)], [ParameterException((a)*1//(q^2-1))], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters([Parameter(b, q^2+sqrt2*q+1)], [ParameterException((b)*1//(q^2+sqrt2*q+1))], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters([Parameter(c, q^2-sqrt2*q+1)], [ParameterException((c)*1//(q^2-sqrt2*q+1))], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[])
]

charparams=[
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters(Parameter{Generic.Poly{nf_elem}}[], ParameterException{Generic.Poly{nf_elem}}[], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters([Parameter(s, q^2-1)], [ParameterException((s)*1//(q^2-1))], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters([Parameter(k, q^2+sqrt2*q+1)], [ParameterException((k)*1//(q^2+sqrt2*q+1))], ParameterSubstitution{Generic.Poly{nf_elem}}[]),
Parameters([Parameter(u, q^2-sqrt2*q+1)], [ParameterException((u)*1//(q^2-sqrt2*q+1))], ParameterSubstitution{Generic.Poly{nf_elem}}[])
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters(Parameter{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterException{Generic.Poly{AbsSimpleNumFieldElem}}[], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters([Parameter(s, q^2-1)], [ParameterException((s)*1//(q^2-1))], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters([Parameter(k, q^2+sqrt2*q+1)], [ParameterException((k)*1//(q^2+sqrt2*q+1))], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[]),
Parameters([Parameter(u, q^2-sqrt2*q+1)], [ParameterException((u)*1//(q^2-sqrt2*q+1))], ParameterSubstitution{Generic.Poly{AbsSimpleNumFieldElem}}[])
]

classparamindex=var_index.([a,b,c])
Expand Down
Loading

0 comments on commit 827578c

Please sign in to comment.