Skip to content

Commit

Permalink
add support to adjoin many elements
Browse files Browse the repository at this point in the history
  • Loading branch information
fieker committed Jan 31, 2024
1 parent a18cece commit e21910a
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions experimental/GModule/Misc.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
module Misc
using Oscar

Hecke.minpoly(a::qqbar) = minpoly(Hecke.Globals.Qx, a)

function primitive_element(a::Vector{qqbar})
pe = a[1]
f = minpoly(pe)
Qx = parent(f)
for i = 2:length(a)
g = minpoly(a[i])
f = minpoly(pe)
k, _ = number_field(f, check = false, cached = false)
lf = collect(keys(factor(k, g).fac))
for j = 1:length(lf)
h = map_coefficients(x->Qx(x)(pe), lf[j])
if is_zero(h(a[i]))
d = degree(f) * degree(h)
mu = 0
while degree(minpoly(pe+mu*a[i])) != d
mu += 1
if mu > 10
error("too bad")

Check warning on line 23 in experimental/GModule/Misc.jl

View check run for this annotation

Codecov / codecov/patch

experimental/GModule/Misc.jl#L6-L23

Added lines #L6 - L23 were not covered by tests
end
end
pe += mu*a[i]

Check warning on line 26 in experimental/GModule/Misc.jl

View check run for this annotation

Codecov / codecov/patch

experimental/GModule/Misc.jl#L25-L26

Added lines #L25 - L26 were not covered by tests
end
end
end
return pe

Check warning on line 30 in experimental/GModule/Misc.jl

View check run for this annotation

Codecov / codecov/patch

experimental/GModule/Misc.jl#L28-L30

Added lines #L28 - L30 were not covered by tests
end

function Hecke.number_field(::QQField, a::Vector{qqbar}; cached::Bool = false)
return number_field(QQ, primitive_element(a))

Check warning on line 34 in experimental/GModule/Misc.jl

View check run for this annotation

Codecov / codecov/patch

experimental/GModule/Misc.jl#L33-L34

Added lines #L33 - L34 were not covered by tests
end

function Hecke.number_field(::QQField, a::qqbar; cached::Bool = false)
f = minpoly(a)
k, b = number_field(f, check = false, cached = cached)
Expand Down Expand Up @@ -34,6 +68,7 @@ function Hecke.number_field(::QQField, a::qqbar; cached::Bool = false)
end

Base.getindex(::QQField, a::qqbar) = number_field(QQ, a)
Base.getindex(::QQField, a::Vector{qqbar}) = number_field(QQ, a)

Check warning on line 71 in experimental/GModule/Misc.jl

View check run for this annotation

Codecov / codecov/patch

experimental/GModule/Misc.jl#L71

Added line #L71 was not covered by tests

function Hecke.numerator(f::QQPolyRingElem, parent::ZZPolyRing = Hecke.Globals.Zx)
g = parent()
Expand Down Expand Up @@ -148,3 +183,6 @@ function cyclo_fixed_group_gens(A::AbstractArray{nf_elem})
end
return [(mR(sR(ms(x))), F) for x = gens(s)]
end

end # module
using .Misc

0 comments on commit e21910a

Please sign in to comment.