Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 297479c

Browse files
committedMar 19, 2025
progress
1 parent 3890143 commit 297479c

File tree

2 files changed

+90
-44
lines changed

2 files changed

+90
-44
lines changed
 

‎experimental/GModule/src/GModule.jl

+89-43
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ function _minimize(V::GModule{<:Oscar.GAPGroup, <:AbstractAlgebra.FPModule{AbsSi
614614
@vprint :MinField 1 "descending to $m...\n"
615615
pe = mm(m[1])
616616
U, mU = sub(domain(mA), [a for a = domain(mA) if mA(a)(pe) == pe])
617+
@assert order(U) == divexact(degree(base_ring(V)), degree(m))
617618
cc = restrict(c, mU)
618619
fl, b = Oscar.is_coboundary(cc)
619620
@assert fl
@@ -1649,6 +1650,7 @@ function _rref!(V::Vector{<:MatElem{<:FieldElem}})
16491650
for k=o+1:length(V)
16501651
iszero(V[k][i]) && continue
16511652
V[k] -= V[k][i] * V[o]
1653+
@assert iszero(V[k][i])
16521654
end
16531655
o += 1
16541656
if o>length(V)
@@ -1676,10 +1678,19 @@ function hom_base(C::GModule{<:Any, <:AbstractAlgebra.FPModule{AbsSimpleNumField
16761678
k = base_ring(C)
16771679
@assert base_ring(m_in[1]) == k
16781680
@assert base_ring(m_in[1]) == k
1681+
is_galois = true
16791682
while true
16801683
p = next_prime(p)
1681-
me = modular_init(k, p, deg_limit = 1)
1682-
isempty(me) && continue
1684+
if is_galois
1685+
me = modular_init(k, p, deg_limit = 1)
1686+
isempty(me) && continue
1687+
if me.ce.n * degree(me.ce.pr[1]) != degree(k)
1688+
is_galois = false
1689+
continue
1690+
end
1691+
else
1692+
me = modular_init(k, p)
1693+
end
16831694
z1 = Hecke.modular_proj(C, me)
16841695
if C === D
16851696
z2 = z1
@@ -1689,10 +1700,18 @@ function hom_base(C::GModule{<:Any, <:AbstractAlgebra.FPModule{AbsSimpleNumField
16891700
t = []
16901701
for i=1:length(z1)
16911702
mp = hom_base(z1[i], z2[i])
1703+
# for x = mp
1704+
# h = hom(z1[i].M, z2[i].M, x)
1705+
# @assert is_G_hom(z1[i], z2[i], h)
1706+
# end
16921707
if isempty(mp)
16931708
return dense_matrix_type(base_ring(C))[]
16941709
end
16951710
_rref!(mp)
1711+
# for x = mp
1712+
# h = hom(z1[i].M, z2[i].M, x)
1713+
# @assert is_G_hom(z1[i], z2[i], h)
1714+
# end
16961715
push!(t, mp)
16971716
end
16981717
#should actually compute an rref of the hom base to make sure
@@ -1705,15 +1724,29 @@ function hom_base(C::GModule{<:Any, <:AbstractAlgebra.FPModule{AbsSimpleNumField
17051724
return []
17061725
end
17071726

1727+
# _t = deepcopy(t)
17081728
tt = [Hecke.modular_lift([t[i][j] for i=1:length(z1)], me) for j=1:length(t[1])]
1729+
# for l=1:length(tt)
1730+
# _s = Hecke.modular_proj(tt[l], me)
1731+
# @assert all(ll -> _s[ll] == _t[ll][l], 1:length(_s))
1732+
# end
1733+
1734+
# tst = [[m_in[i]*s - s*m_out[i] for i= 1:length(m_in)] for s = tt]
1735+
# @show [[map_entries(x->valuation(x, ZZ(p)), y) for y = z] for z = tst]
1736+
# if valuation(tst[1][1][1,1], ZZ(p)) == 0
1737+
# global last_bad = (tst, tt, p)
1738+
# error("bad")
1739+
# end
17091740
@assert base_ring(tt[1]) == k
17101741
if isone(pp)
17111742
pp = ZZRingElem(p)
17121743
T = tt
17131744
else
17141745
T = [induce_crt(tt[i], T[i], ZZRingElem(p), pp) for i=1:length(T)]
1746+
# tst = [[m_in[i]*s - s*m_out[i] for i= 1:length(m_in)] for s = T]
17151747
@assert base_ring(T[1]) == k
17161748
pp *= p
1749+
# @show [[map_entries(x->valuation(x, pp), y) for y = z] for z = tst]
17171750
S = typeof(T[1])[]
17181751
for t = T
17191752
fl, s = induce_rational_reconstruction(t, pp, ErrorTolerant = true)
@@ -1732,6 +1765,11 @@ function hom_base(C::GModule{<:Any, <:AbstractAlgebra.FPModule{AbsSimpleNumField
17321765
end
17331766
end
17341767

1768+
function Hecke.valuation(a::NumFieldElem, p::ZZRingElem)
1769+
iszero(a) && return -1
1770+
return minimum([valuation(coeff(a, i), p) for i=0:degree(parent(a))-1 if !iszero(coeff(a, i))])
1771+
end
1772+
17351773
function center_hom_base(C::GModule{<:Any, <:AbstractAlgebra.FPModule{QQFieldElem}})
17361774
p = Hecke.p_start
17371775
p = 2^10
@@ -1749,14 +1787,10 @@ function center_hom_base(C::GModule{<:Any, <:AbstractAlgebra.FPModule{QQFieldEle
17491787
while true
17501788
p = next_prime(p)
17511789
z1 = gmodule(Native.GF(p), C)
1752-
@show p
1753-
@time t = hom_base(z1, z1)
1754-
@show length(t)
1790+
t = hom_base(z1, z1)
17551791
isempty(t) && return QQMatrix[]
1756-
@time c, mc = center(matrix_algebra(base_ring(z1), t; isbasis = true))
1757-
@show c
1792+
c, mc = center(matrix_algebra(base_ring(z1), t; isbasis = true))
17581793
t = [mc(x).matrix for x = basis(c)]
1759-
@show length(t)
17601794

17611795
_rref!(t)
17621796
tt = [lift(s) for s=t]
@@ -1954,7 +1988,7 @@ function split_homogeneous(M::GModule{<:Any, <:AbstractAlgebra.FPModule{QQFieldE
19541988
B = lll_basis(Z_M)
19551989
@assert all(!iszero, B)
19561990
seen = Set{elem_type(E)}()
1957-
#=
1991+
19581992
for b = B
19591993
x = b.elem_in_algebra
19601994
if x in seen
@@ -1985,7 +2019,7 @@ function split_homogeneous(M::GModule{<:Any, <:AbstractAlgebra.FPModule{QQFieldE
19852019
length(z) > 0 && return z
19862020
end
19872021
end
1988-
=#
2022+
#
19892023

19902024
#=
19912025
p = 10000
@@ -2009,7 +2043,7 @@ function split_homogeneous(M::GModule{<:Any, <:AbstractAlgebra.FPModule{QQFieldE
20092043
end
20102044
=#
20112045

2012-
#=
2046+
20132047
mb = matrix(QQ, transpose(hcat([coefficients(x.elem_in_algebra) for x = B]...)))
20142048
T = 10
20152049
for i=1:T
@@ -2024,7 +2058,7 @@ function split_homogeneous(M::GModule{<:Any, <:AbstractAlgebra.FPModule{QQFieldE
20242058
length(z) > 0 && return z
20252059
end
20262060
end
2027-
=#
2061+
20282062

20292063
return S
20302064
end
@@ -2067,10 +2101,11 @@ function split_homogeneous2(M::GModule{<:Any, <:AbstractAlgebra.FPModule{QQField
20672101
local best_f::QQPolyRingElem
20682102
local best_i::elem_type(E)
20692103

2070-
for i=basis(E)
2104+
for _i=lll_basis(Z_M)
2105+
i = _i.elem_in_algebra
20712106
f = minpoly(i)
20722107
lf = factor(f)
2073-
if length(lf) == 1 && degree(f) == s*m*k && lf[f] == 1
2108+
if length(lf) == 1 && degree(f) == s*m*k && haskey(lf.fac, f)
20742109
if first
20752110
best_f = f
20762111
best_i = i
@@ -2104,6 +2139,7 @@ function Oscar.eigenspace(f::Oscar.GModuleHom{<:Any, T, T}, a::AbsSimpleNumField
21042139
@req codomain(f) == M "1st argument must be an endomorphism"
21052140
Mf = extension_of_scalars(M, Ka)
21062141
h = hom(Mf, Mf, hom(Mf.M, Mf.M, map_entries(Ka, f.module_map.matrix) - a*identity_matrix(Ka, dim(M))))
2142+
global last_h = h
21072143
return kernel(h)[1]
21082144
end
21092145

@@ -2328,52 +2364,67 @@ function action_matrices(C::GModule{<:Any, <:AbstractAlgebra.FPModule})
23282364
return map(matrix, action(C))
23292365
end
23302366

2331-
#=
23322367
function form_reynold(C::GModule{<:Any, <:AbstractAlgebra.FPModule{ZZRingElem}})
23332368
I = identity_matrix(ZZ, rank(C.M))
2334-
O = I
23352369
de = ZZ(1)
2370+
iter = []
23362371
for x = C.ac
2337-
O *= (I-matrix(x))
2338-
de *= 2
2372+
push!(iter, [matrix(x)])
2373+
l = 1
2374+
while !is_one(iter[end][end])
2375+
push!(iter[end], iter[end][1]*iter[end][end])
2376+
l += 1
2377+
end
2378+
@assert length(iter[end]) == l
2379+
@assert is_one(iter[end][end])
2380+
de *= l
23392381
end
2340-
for i=1:-1
2382+
for i=1:-4
23412383
l = rand(C.G)
2342-
O *= (I-action(C, l).matrix)
2384+
is_one(l) && continue
2385+
2386+
push!(iter, [I, action(C, l).matrix])
23432387
de *= 2
2344-
@show order(l)
23452388
end
23462389
a = identity_matrix(ZZ, rank(C.M))
2347-
@show rank(C.M)
2390+
a = matrix(ZZ, rand(-10:10, rank(C.M), rank(C.M)))
2391+
a = a*transpose(a)
2392+
@assert is_symmetric(a)
2393+
@assert is_positive_definite(a)
2394+
23482395
den = ZZ(1)
23492396
for i=1:70
23502397
# @assert is_symmetric(a)
23512398
# @show signature_tuple(integer_lattice(;gram = a))
23522399
# @assert is_positive_definite(a)
23532400
# global last_a_in = deepcopy(a)
2354-
a = transpose(O)*a*(O)
2401+
for D = iter
2402+
a = sum(t*a*transpose(t) for t = D)
2403+
end
23552404
# global last_a_out = (a, g)
23562405

23572406
# @assert is_symmetric(a)
23582407
# @show signature_tuple(integer_lattice(;gram = a))
23592408
# @assert is_positive_definite(a)
23602409
den *= de
23612410
@show nbits(den), maximum(nbits, a)
2362-
aa = a*QQ(1, 240*den)
2363-
@assert is_positive_definite(aa)
2411+
aa = a*QQ(order(C.G), den)
2412+
# @assert is_positive_definite(aa)
23642413
aa = map_entries(x->abs(x-round(x)), aa)
2365-
@show [nbits(denominator(x)) for x = convergents(continued_fraction(aa[10,10]))]
2414+
# @show [nbits(denominator(x)) for x = convergents(continued_fraction(aa[10,10]))]
23662415
@show maximum(aa)*1.0
23672416
if maximum(aa) < 1e-5
2368-
a = map_entries(x->round(ZZRingElem, QQ(x, den)), a)
2369-
error("ASDasd")
2417+
a = map_entries(x->round(ZZRingElem, QQ(x*order(C.G), den)), a)
2418+
if any(x->x.matrix * a *transpose(x.matrix) != a, C.ac)
2419+
@show :bad
2420+
continue
2421+
end
23702422
@assert is_positive_definite(a)
23712423
return a
23722424
end
23732425
end
23742426
end
23752427

2376-
=#
23772428

23782429
function Oscar.simplify(C::GModule{<:Any, <:AbstractAlgebra.FPModule{ZZRingElem}})
23792430
# f = invariant_forms(C)[1]
@@ -2382,32 +2433,27 @@ function Oscar.simplify(C::GModule{<:Any, <:AbstractAlgebra.FPModule{ZZRingElem}
23822433
m = map(matrix, C.ac)
23832434
S = identity_matrix(ZZ, dim(C))
23842435
while true
2385-
f = zero_matrix(ZZ, dim(C), dim(C))
2386-
for i=(C.G)
2387-
@show i
2388-
x = action(C, i)
2389-
f = f + matrix(x)*transpose(matrix(x))
2390-
@assert is_symmetric(f)
2391-
end
2436+
# f = zero_matrix(ZZ, dim(C), dim(C))
2437+
# for i=(C.G)
2438+
# @show i
2439+
# x = action(C, i)
2440+
# f = f + matrix(x)*transpose(matrix(x))
2441+
# @assert is_symmetric(f)
2442+
# end
2443+
f = form_reynold(C)
23922444
# @assert is_symmetric(f)
23932445
# @assert is_positive_definite(f)
2394-
global last_f = f
23952446
L, T = lll_gram_with_transform(f)
23962447
@assert L == T*f*transpose(T)
23972448

23982449
Ti = inv(T)
23992450
n = [T*x*Ti for x = m]
2400-
@show length(string(n)), length(string(m))
2401-
@show sum([maximum(nbits, x) for x = n])
2402-
@show sum([maximum(nbits, x) for x = m])
24032451
if length(string(n)) >= length(string(m))
24042452
return C, S
24052453
end
2406-
error("ASD")
24072454
S = T*S
24082455
C = gmodule(group(C), n)
2409-
f = invariant_forms(C)[1]
2410-
M = n
2456+
m = n
24112457
end
24122458
end
24132459

‎experimental/GModule/src/Misc.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ function Hecke.induce_rational_reconstruction(a::Generic.MatSpaceElem{AbsSimpleN
336336
c = parent(a)()
337337
for i=1:nrows(a)
338338
for j=1:ncols(a)
339-
fl, c[i,j] = rational_reconstruction(a[i,j], pg)#, ErrorTolerant = ErrorTolerant)
339+
fl, c[i,j] = rational_reconstruction(a[i,j], pg; error_tolerant = ErrorTolerant)
340340
fl || return fl, c
341341
end
342342
end

0 commit comments

Comments
 (0)
Please sign in to comment.