Skip to content

Commit

Permalink
Towards lattices (#1283)
Browse files Browse the repository at this point in the history
  • Loading branch information
thofma authored Nov 21, 2023
1 parent ac409f1 commit 7a7abf4
Show file tree
Hide file tree
Showing 25 changed files with 955 additions and 178 deletions.
11 changes: 10 additions & 1 deletion src/AlgAss/AbsAlgAss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,8 @@ end

# Given epimorphism h : A -> B, transport the refined wedderburn decomposition
# of A to B
function _transport_refined_wedderburn_decomposition_forward(h::AbsAlgAssMor)
function _transport_refined_wedderburn_decomposition_forward(h::AbsAlgAssMor; is_anti::Bool = false)
# is_anti = h is anti-morphism
A = domain(h)
B = codomain(h)

Expand Down Expand Up @@ -1510,7 +1511,15 @@ function _transport_refined_wedderburn_decomposition_forward(h::AbsAlgAssMor)
CtoBc = hom(C, Bc, M, inv(M))
if isdefined(C, :isomorphic_full_matrix_algebra)
CM, CtoCM = C.isomorphic_full_matrix_algebra
#bmat = basis_matrix([CM(transpose(matrix(x)), check = false) for x in basis(CM)])
#ff = hom(CM, CM, bmat, inv(bmat))
f = AbsAlgAssMorGen(Bc, CM, inv(CtoBc).mat * CtoCM.M, CtoCM.Minv * CtoBc.mat)
if is_anti
BB = matrix([coefficients(CM(transpose(matrix(f(b))), check = false)) for b in basis(Bc)])
BBinv = matrix([coefficients(preimage(CtoCM, CM(transpose(matrix(b)), check = false))) for b in _absolute_basis(CM)])
#BBinv = inv(BB)
f = AbsAlgAssMorGen(Bc, CM, BB, BBinv)
end
Bc.isomorphic_full_matrix_algebra = CM, f
end
end
Expand Down
255 changes: 132 additions & 123 deletions src/AlgAss/AlgGrp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,21 @@ end
#
################################################################################

function show(io::IO, ::MIME"text/plain", A::AlgGrp)
io = pretty(io)
println(io, "Group algebra")
print(io, Indent())
println(io, "of ", Lowercase(), group(A))
print(io, "over ", Lowercase(), base_ring(A))
print(io, Dedent())
end

function show(io::IO, A::AlgGrp)
compact = get(io, :compact, false)
if compact
if get(io, :supercompact, false)
print(io, "Group algebra of dimension ", dim(A), " over ", base_ring(A))
else
print(io, "Group algebra of group\n", group(A), "\nover\n", base_ring(A))
print(io, "Group algebra of group of order ", order(group(A)), " over ")
print(IOContext(io, :supercompact => true), base_ring(A))
end
end

Expand Down Expand Up @@ -491,121 +500,121 @@ end

automorphism_map(f::NfToAlgGrpMor) = f.mG

function galois_module(K::AnticNumberField, aut::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K))
G = domain(aut)
A = FlintQQ[G]
return _galois_module(K, A, aut, normal_basis_generator = normal_basis_generator)
end

function _galois_module(K::AnticNumberField, A, aut::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K))
G = domain(aut)
alpha = normal_basis_generator

basis_alpha = Vector{elem_type(K)}(undef, dim(A))
for (i, g) in enumerate(G)
f = aut(g)
basis_alpha[A.group_to_base[g]] = f(alpha)
end

M = zero_matrix(base_field(K), degree(K), degree(K))
for i = 1:degree(K)
a = basis_alpha[i]
for j = 1:degree(K)
M[i, j] = coeff(a, j - 1)
end
end

invM = inv(M)

z = NfToAlgGrpMor{QQFieldElem, GrpGen, GrpGenElem}()
z.K = K
z.mG = aut
z.A = A
z.M = M
z.Minv = invM

return A, z
end

function galois_module(K::AnticNumberField, A::AlgGrp; normal_basis_generator = normal_basis(K))
G = group(A)
Au, mAu = automorphism_group(K)
fl, f = is_isomorphic_with_map(G, Au)
@assert fl
aut = Vector{NfToNfMor}(undef, order(G))
for g in G
aut[g[]] = mAu(f(g))
end
h = GrpGenToNfMorSet(G, aut, K)

return _galois_module(K, A, h, normal_basis_generator = normal_basis(K))
end

domain(f::NfToAlgGrpMor) = f.K

codomain(f::NfToAlgGrpMor) = f.A

function image(f::NfToAlgGrpMor, x::nf_elem)
K = domain(f)
@assert parent(x) === K
A = codomain(f)

t = zero_matrix(base_field(K), 1, degree(K))
for i = 1:degree(K)
t[1, i] = coeff(x, i - 1)
end
y = t*f.Minv
return A([ y[1, i] for i = 1:degree(K) ])
end

function preimage(f::NfToAlgGrpMor, x::AlgGrpElem)
K = domain(f)
t = matrix(base_field(K), 1, degree(K), coefficients(x))
y = t*f.M
v = QQFieldElem[ y[1, i] for i = 1:degree(K) ]
return K(v)
end

# Returns the group algebra Q[G] where G = Gal(K/Q) and a Q-linear map from K
# to Q[G] and one from Q[G] to K
function _galois_module(K::AnticNumberField, to_automorphisms::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K))
G = domain(to_automorphisms)
A = FlintQQ[G]
alpha = normal_basis_generator

basis_alpha = Vector{elem_type(K)}(undef, dim(A))
for (i, g) in enumerate(G)
f = to_automorphisms(g)
basis_alpha[A.group_to_base[g]] = f(alpha)
end

M = zero_matrix(base_field(K), degree(K), degree(K))
for i = 1:degree(K)
a = basis_alpha[i]
for j = 1:degree(K)
M[i, j] = coeff(a, j - 1)
end
end

invM = inv(M)

function KtoA(x::nf_elem)
t = zero_matrix(base_field(K), 1, degree(K))
for i = 1:degree(K)
t[1, i] = coeff(x, i - 1)
end
y = t*invM
return A([ y[1, i] for i = 1:degree(K) ])
end

function AtoK(x::AlgGrpElem)
t = matrix(base_field(K), 1, degree(K), coefficients(x))
y = t*M
return K(parent(K.pol)([ y[1, i] for i = 1:degree(K) ]))
end

return A, KtoA, AtoK
end
#function galois_module(K::AnticNumberField, aut::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K))
# G = domain(aut)
# A = FlintQQ[G]
# return _galois_module(K, A, aut, normal_basis_generator = normal_basis_generator)
#end
#
#function _galois_module(K::AnticNumberField, A, aut::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K))
# G = domain(aut)
# alpha = normal_basis_generator
#
# basis_alpha = Vector{elem_type(K)}(undef, dim(A))
# for (i, g) in enumerate(G)
# f = aut(g)
# basis_alpha[A.group_to_base[g]] = f(alpha)
# end
#
# M = zero_matrix(base_field(K), degree(K), degree(K))
# for i = 1:degree(K)
# a = basis_alpha[i]
# for j = 1:degree(K)
# M[i, j] = coeff(a, j - 1)
# end
# end
#
# invM = inv(M)
#
# z = NfToAlgGrpMor{QQFieldElem, GrpGen, GrpGenElem}()
# z.K = K
# z.mG = aut
# z.A = A
# z.M = M
# z.Minv = invM
#
# return A, z
#end
#
#function galois_module(K::AnticNumberField, A::AlgGrp; normal_basis_generator = normal_basis(K))
# G = group(A)
# Au, mAu = automorphism_group(K)
# fl, f = is_isomorphic_with_map(G, Au)
# @assert fl
# aut = Vector{NfToNfMor}(undef, order(G))
# for g in G
# aut[g[]] = mAu(f(g))
# end
# h = GrpGenToNfMorSet(G, aut, K)
#
# return _galois_module(K, A, h, normal_basis_generator = normal_basis(K))
#end
#
#domain(f::NfToAlgGrpMor) = f.K
#
#codomain(f::NfToAlgGrpMor) = f.A
#
#function image(f::NfToAlgGrpMor, x::nf_elem)
# K = domain(f)
# @assert parent(x) === K
# A = codomain(f)
#
# t = zero_matrix(base_field(K), 1, degree(K))
# for i = 1:degree(K)
# t[1, i] = coeff(x, i - 1)
# end
# y = t*f.Minv
# return A([ y[1, i] for i = 1:degree(K) ])
#end
#
#function preimage(f::NfToAlgGrpMor, x::AlgGrpElem)
# K = domain(f)
# t = matrix(base_field(K), 1, degree(K), coefficients(x))
# y = t*f.M
# v = QQFieldElem[ y[1, i] for i = 1:degree(K) ]
# return K(v)
#end
#
## Returns the group algebra Q[G] where G = Gal(K/Q) and a Q-linear map from K
## to Q[G] and one from Q[G] to K
#function _galois_module(K::AnticNumberField, to_automorphisms::Map = automorphism_group(K)[2]; normal_basis_generator = normal_basis(K))
# G = domain(to_automorphisms)
# A = FlintQQ[G]
# alpha = normal_basis_generator
#
# basis_alpha = Vector{elem_type(K)}(undef, dim(A))
# for (i, g) in enumerate(G)
# f = to_automorphisms(g)
# basis_alpha[A.group_to_base[g]] = f(alpha)
# end
#
# M = zero_matrix(base_field(K), degree(K), degree(K))
# for i = 1:degree(K)
# a = basis_alpha[i]
# for j = 1:degree(K)
# M[i, j] = coeff(a, j - 1)
# end
# end
#
# invM = inv(M)
#
# function KtoA(x::nf_elem)
# t = zero_matrix(base_field(K), 1, degree(K))
# for i = 1:degree(K)
# t[1, i] = coeff(x, i - 1)
# end
# y = t*invM
# return A([ y[1, i] for i = 1:degree(K) ])
# end
#
# function AtoK(x::AlgGrpElem)
# t = matrix(base_field(K), 1, degree(K), coefficients(x))
# y = t*M
# return K(parent(K.pol)([ y[1, i] for i = 1:degree(K) ]))
# end
#
# return A, KtoA, AtoK
#end

const _reps = [(i=24,j=12,n=5,dims=(1,1,2,3,3),
reps=Vector{Vector{Rational{BigInt}}}[[[1],[1],[1],[1]],
Expand Down Expand Up @@ -928,13 +937,13 @@ function _absolute_basis(A)
n = degree(K)
B = Vector{elem_type(A)}()
bK = basis(K)
for i in 1:n
for j in 1:m
for i in 1:m
for j in 1:n
v = Vector{elem_type(K)}(undef, m)
for k in 1:m
v[i] = zero(K)
v[k] = zero(K)
end
v[j] = bK[j]
v[i] = bK[j]
push!(B, A(v))
end
end
Expand Down Expand Up @@ -1107,7 +1116,7 @@ function is_almost_maximally_ramified(K::AnticNumberField, p::ZZRingElem)
return true
end

function hom(KG::AlgGrp, KH::AlgGrp, m::GrpGenToGrpGenMor)
function hom(KG::AlgGrp, KH::AlgGrp, m::Map)
@assert base_ring(KG) === base_ring(KH)
K = base_ring(KG)
M = zero_matrix(K, dim(KG), dim(KH))
Expand Down
16 changes: 16 additions & 0 deletions src/AlgAss/AlgMat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,22 @@ function multiplication_table(A::AlgMat; copy::Bool = true)
end
end

function denominator_of_multiplication_table(A::AlgMat)
get_attribute!(A, :denominator_of_multiplication_table) do
den = one(ZZ)
mt = multiplication_table(A)
d = degree(A)
for i in 1:d
for j in 1:d
for k in 1:d
den = lcm!(den, den, denominator(mt[i, j, k]))
end
end
end
return den
end::ZZRingElem
end

################################################################################
#
# Construction
Expand Down
14 changes: 7 additions & 7 deletions src/AlgAss/AlgMatElem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ end

function +(a::AlgMatElem{T, S, V}, b::AlgMatElem{T, S, V}) where {T, S, V}
parent(a) != parent(b) && error("Parents don't match.")
c = parent(a)(matrix(a, copy = false) + matrix(b, copy = false))
c = parent(a)(matrix(a, copy = false) + matrix(b, copy = false), check = false)
if a.has_coeffs && b.has_coeffs
c.coeffs = [ coefficients(a, copy = false)[i] + coefficients(b, copy = false)[i] for i = 1:dim(parent(a)) ]
c.has_coeffs = true
Expand Down Expand Up @@ -157,25 +157,25 @@ function *(a::AlgMatElem, b::T) where {T <: RingElem}
if parent(b) == base_ring(A)
b = coefficient_ring(A)(b)
end
return A(matrix(a, copy = false)*b)::elem_type(A)
return A(matrix(a, copy = false)*b, check = false)::elem_type(A)
end

function *(b::T, a::AlgMatElem) where {T <: RingElem}
A = parent(a)
if parent(b) == base_ring(A)
b = coefficient_ring(A)(b)
end
return A(b*matrix(a, copy = false))::elem_type(A)
return A(b*matrix(a, copy = false), check = false)::elem_type(A)
end

function *(a::AlgMatElem{S, T, U}, b::U) where { S, T, U <: MatElem }
A = parent(a)
return A(matrix(a, copy = false)*b)
return A(matrix(a, copy = false)*b, check = false)
end

function *(b::U, a::AlgMatElem{S, T, U}) where { S, T, U <: MatElem }
A = parent(a)
return A(b*matrix(a, copy = false))
return A(b*matrix(a, copy = false), check = false)
end

################################################################################
Expand Down Expand Up @@ -224,7 +224,7 @@ end

function (A::AlgMat)()
n = degree(A)
return A(zero_matrix(coefficient_ring(A), n, n))
return A(zero_matrix(coefficient_ring(A), n, n), check = false)
end

function (A::AlgMat{T, S})(M::S; check::Bool = true) where {T, S}
Expand Down Expand Up @@ -262,7 +262,7 @@ function (A::AlgMat{T, S})(v::Vector{T}; copy::Bool = true) where { T, S }
#M = add!(M, M, matrix(basis(A)[i], copy = false)*v[i])
M += matrix(B[i], copy = false)*R(v[i])
end
a = A(M)
a = A(M; check = false)
if copy
a.coeffs = Base.copy(v)
else
Expand Down
Loading

0 comments on commit 7a7abf4

Please sign in to comment.