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

Matrix groups: cleanup some use of frobenius #4079

Merged
merged 6 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
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
25 changes: 16 additions & 9 deletions src/Groups/matrices/matrix_manipulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,21 @@ end
conjugate_transpose(x::MatElem{T}) where T <: FinFieldElem

If the base ring of `x` is `GF(q^2)`, return the matrix `transpose( map ( y -> y^q, x) )`.
An exception is thrown if the base ring does not have even degree.
An exception is thrown if the base ring does not have even degree.
"""
function conjugate_transpose(x::MatElem{T}) where T <: FinFieldElem
@req iseven(degree(base_ring(x))) "The base ring must have even degree"
e = div(degree(base_ring(x)),2)
return transpose(map(y -> frobenius(y,e),x))
e = degree(base_ring(x))
@req iseven(e) "The base ring must have even degree"
e = div(e, 2)

y = similar(x, ncols(x), nrows(x))
for i in 1:nrows(x), j in 1:ncols(x)
# This code could be *much* faster, by precomputing the Frobenius map
# once; see also FrobeniusCtx in Hecke (but that does not yet support all
# finite field types at the time this comment was written).
# If you need this function to be faster, talk to Claus or Max.
y[i,j] = frobenius([x[j,i]],e)
end
end


Expand Down Expand Up @@ -124,14 +133,12 @@ Return `false` if `B` is not a square matrix, or the field has not even degree.
"""
function is_hermitian(B::MatElem{T}) where T <: FinFieldElem
n = nrows(B)
n==ncols(B) || return false
n == ncols(B) || return false
e = degree(base_ring(B))
iseven(e) ? e = div(e,2) : return false

for i in 1:n
for j in i:n
B[i,j]==frobenius(B[j,i],e) || return false
end
for i in 1:n, j in i:n
B[i,j] == frobenius(B[j,i],e) || return false
end

return true
Expand Down
18 changes: 11 additions & 7 deletions src/Groups/matrices/transform_form.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ function _find_radical(B::MatElem{T}, F::Field, nr::Int, nc::Int; e::Int=0, _is_
# A = matrix(vcat(type_vector[embU(v) for v in gens(U)], type_vector[embK(v) for v in gens(K)] ))

if _is_symmetric
return A*B*transpose(map(y -> frobenius(y,e),A)), A, d
if e == 0
return A*B*transpose(A), A, d
else
return A*B*conjugate_transpose(A), A, d
end
else
A = transpose(A)
return B*A, A, d
Expand All @@ -64,7 +68,7 @@ end
# returns D, A such that A*B*transpose(frobenius(A)) = D and
# D is diagonal matrix (or with blocks [0 1 s 0])
# f = dimension of the zero block in B in the isotropic case
function _block_anisotropic_elim(B::MatElem{T}, _type::Symbol; isotr=false, f=0) where T <: FinFieldElem
function _block_anisotropic_elim(B::MatElem{T}, ::Val{_type}; isotr=false, f=0) where {T <: FinFieldElem, _type}

d = nrows(B)
F = base_ring(B)
Expand All @@ -75,17 +79,17 @@ function _block_anisotropic_elim(B::MatElem{T}, _type::Symbol; isotr=false, f=0)
if _type==:symmetric
degF=0
s=1
star(X) = transpose(X)
elseif _type==:alternating
degF=0
s=-1
star(X) = transpose(X)
elseif _type==:hermitian
degF=div(degree(F),2)
s=1
star(X) = conjugate_transpose(X)
end
mjrodgers marked this conversation as resolved.
Show resolved Hide resolved

# conjugate transpose in hermitian case
# transpose in the other cases
star(X) = transpose(map(y -> frobenius(y,degF),X))

if isotr
q = characteristic(F)^degF
Expand Down Expand Up @@ -181,9 +185,9 @@ function _block_herm_elim(B::MatElem{T}, _type) where T <: FinFieldElem
c = Int(ceil(d/2))
B2 = B[1:c, 1:c]
if B2==0
D,A = _block_anisotropic_elim(B,_type; isotr=true, f=c)
D,A = _block_anisotropic_elim(B, Val(_type); isotr=true, f=c)
else
D,A = _block_anisotropic_elim(B,_type)
D,A = _block_anisotropic_elim(B, Val(_type))
end

return D,A
Expand Down
Loading