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

Towards lattices #1283

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
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 @@

# 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 @@
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)])

Check warning on line 1519 in src/AlgAss/AbsAlgAss.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AbsAlgAss.jl#L1517-L1519

Added lines #L1517 - L1519 were not covered by tests
#BBinv = inv(BB)
f = AbsAlgAssMorGen(Bc, CM, BB, BBinv)

Check warning on line 1521 in src/AlgAss/AbsAlgAss.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AbsAlgAss.jl#L1521

Added line #L1521 was not covered by tests
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 @@
#
################################################################################

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())

Check warning on line 135 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L129-L135

Added lines #L129 - L135 were not covered by tests
end

function show(io::IO, A::AlgGrp)
compact = get(io, :compact, false)
if compact
if get(io, :supercompact, false)

Check warning on line 139 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L139

Added line #L139 was not covered by tests
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))

Check warning on line 143 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L142-L143

Added lines #L142 - L143 were not covered by tests
end
end

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

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 @@
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

Check warning on line 941 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L940-L941

Added lines #L940 - L941 were not covered by tests
v = Vector{elem_type(K)}(undef, m)
for k in 1:m
v[i] = zero(K)
v[k] = zero(K)

Check warning on line 944 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L944

Added line #L944 was not covered by tests
end
v[j] = bK[j]
v[i] = bK[j]

Check warning on line 946 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L946

Added line #L946 was not covered by tests
push!(B, A(v))
end
end
Expand Down Expand Up @@ -1107,7 +1116,7 @@
return true
end

function hom(KG::AlgGrp, KH::AlgGrp, m::GrpGenToGrpGenMor)
function hom(KG::AlgGrp, KH::AlgGrp, m::Map)

Check warning on line 1119 in src/AlgAss/AlgGrp.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgGrp.jl#L1119

Added line #L1119 was not covered by tests
@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 @@
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

Check warning on line 236 in src/AlgAss/AlgMat.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgMat.jl#L224-L236

Added lines #L224 - L236 were not covered by tests
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 @@

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 @@
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)

Check warning on line 160 in src/AlgAss/AlgMatElem.jl

View check run for this annotation

Codecov / codecov/patch

src/AlgAss/AlgMatElem.jl#L160

Added line #L160 was not covered by tests
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 @@

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 @@
#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
Loading