Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to adjoin many elements #3294

Merged
merged 2 commits into from
Feb 1, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe also

Suggested change
Base.getindex(::QQField, a::Vector{qqbar}) = number_field(QQ, a)
Base.getindex(::QQField, a::Vector{qqbar}) = number_field(QQ, a)
Base.getindex(::QQField, a::qbar, as::qqbar...) = number_field(QQ, [a, as...])

for interactive use: QQ[s,c]


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

end # module
using .Misc
Loading