Skip to content

Commit

Permalink
Improve Plesken--Souvignier (#1320)
Browse files Browse the repository at this point in the history
* Vector sums in Plesken--Souvignier

* Bacher polynomials
  • Loading branch information
joschmitt authored Dec 15, 2023
1 parent fc9ea20 commit 97bd536
Show file tree
Hide file tree
Showing 7 changed files with 993 additions and 580 deletions.
2 changes: 1 addition & 1 deletion src/QuadForm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ include("QuadForm/MassQuad.jl")
# Close vectors
include("QuadForm/CloseVectors.jl")

# indefinite LLL
# indefinite LLL
include("QuadForm/indefiniteLLL.jl")

# Functionality for IO with Hecke/Magma
Expand Down
56 changes: 37 additions & 19 deletions src/QuadForm/Lattices.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ end
# of rows of f should be divisible by the absolute degree of the parent of b
#
# Here _mb is the asolute multiplication matrix of b and mb is a block diagonal
# matrix consisting of an appropriate number of copies of _mb
# matrix consisting of an appropriate number of copies of _mb
function _admissible_basis(f::QQMatrix, _mb::QQMatrix, mb::QQMatrix)
# we look for a basis on which f acts blockwise
# as multiplication by b along extension of scalars
Expand Down Expand Up @@ -1450,7 +1450,7 @@ end
# per default, the are given with respect to the basis of the ambient space
# if ambient_representation = true, they are given with respect to the coordinate
# space/ambient space
function assert_has_automorphisms(L::AbstractLat{<: NumField}; redo::Bool = false)
function assert_has_automorphisms(L::AbstractLat{<: NumField}; redo::Bool = false, depth::Int = -1, bacher_depth::Int = 0)

if !redo && isdefined(L, :automorphism_group_generators)
return nothing
Expand Down Expand Up @@ -1478,13 +1478,13 @@ function assert_has_automorphisms(L::AbstractLat{<: NumField}; redo::Bool = fals
# Create the automorphism context and compute generators as well as orders

C = ZLatAutoCtx(ZgramL)
fl, Csmall = try_init_small(C)
fl, Csmall = try_init_small(C, depth = depth, bacher_depth = bacher_depth)
if fl
auto(Csmall)
_gens, order = _get_generators(Csmall)
gens = ZZMatrix[matrix(ZZ, g) for g in _gens]
else
init(C)
init(C, depth = depth, bacher_depth = bacher_depth)
auto(C)
gens, order = _get_generators(C)
end
Expand Down Expand Up @@ -1559,19 +1559,24 @@ end
################################################################################

@doc raw"""
automorphism_group_generators(L::AbstractLat; ambient_representation::Bool = true)
automorphism_group_generators(L::AbstractLat; ambient_representation::Bool = true,
depth::Int = -1, bacher_depth::Int = 0)
-> Vector{MatElem}
Given a definite lattice `L`, return generators for the automorphism group of `L`.
If `ambient_representation == true` (the default), the transformations are represented
with respect to the ambient space of `L`. Otherwise, the transformations are represented
with respect to the (pseudo-)basis of `L`.
Setting the parameters `depth` and `bacher_depth` to a positive value may improve
performance. If set to `-1` (default), the used value of `depth` is chosen
heuristically depending on the rank of `L`. By default, `bacher_depth` is set to `0`.
"""
automorphism_group_generators(L::AbstractLat; ambient_representation::Bool = true)
automorphism_group_generators(L::AbstractLat; ambient_representation::Bool = true, depth::Int = -1, bacher_depth::Int = 0)

function automorphism_group_generators(L::AbstractLat; ambient_representation::Bool = true, check = false)
function automorphism_group_generators(L::AbstractLat; ambient_representation::Bool = true, check = false, depth::Int = -1, bacher_depth::Int = 0)

assert_has_automorphisms(L)
assert_has_automorphisms(L, depth = depth, bacher_depth = bacher_depth)

gens = L.automorphism_group_generators

Expand Down Expand Up @@ -1611,14 +1616,18 @@ end
################################################################################

@doc raw"""
automorphism_group_order(L::AbstractLat) -> Int
automorphism_group_order(L::AbstractLat; depth::Int = -1, bacher_depth::Int = 0) -> Int
Given a definite lattice `L`, return the order of the automorphism group of `L`.
Setting the parameters `depth` and `bacher_depth` to a positive value may improve
performance. If set to `-1` (default), the used value of `depth` is chosen
heuristically depending on the rank of `L`. By default, `bacher_depth` is set to `0`.
"""
automorphism_group_order(L::AbstractLat; redo::Bool = false)
automorphism_group_order(L::AbstractLat; redo::Bool = false, depth::Int = -1, bacher_depth::Int = 0)

function automorphism_group_order(L::AbstractLat; redo::Bool = false)
assert_has_automorphisms(L; redo)
function automorphism_group_order(L::AbstractLat; redo::Bool = false, depth::Int = -1, bacher_depth::Int = 0)
assert_has_automorphisms(L; redo, depth = depth, bacher_depth = bacher_depth)
return L.automorphism_group_order
end

Expand All @@ -1629,15 +1638,20 @@ end
################################################################################

@doc raw"""
is_isometric(L::AbstractLat, M::AbstractLat) -> Bool
is_isometric(L::AbstractLat, M::AbstractLat; depth::Int = -1, bacher_depth::Int = 0) -> Bool
Return whether the lattices `L` and `M` are isometric.
Setting the parameters `depth` and `bacher_depth` to a positive value may improve
performance. If set to `-1` (default), the used value of `depth` is chosen
heuristically depending on the rank of `L`. By default, `bacher_depth` is set to `0`.
"""
is_isometric(L::AbstractLat, M::AbstractLat) = is_isometric_with_isometry(L, M; ambient_representation=false)[1]
is_isometric(L::AbstractLat, M::AbstractLat; depth::Int = -1, bacher_depth::Int = 0) = is_isometric_with_isometry(L, M; ambient_representation=false, depth = depth, bacher_depth = bacher_depth)[1]


@doc raw"""
is_isometric_with_isometry(L::AbstractLat, M::AbstractLat; ambient_representation::Bool = true)
is_isometric_with_isometry(L::AbstractLat, M::AbstractLat; ambient_representation::Bool = true
depth::Int = -1, bacher_depth::Int = 0)
-> (Bool, MatElem)
Return whether the lattices `L` and `M` are isometric. If this is the case, the
Expand All @@ -1650,12 +1664,16 @@ matrices of the ambient spaces of `L` and `M` respectively. If
to the (pseudo-)bases of `L` and `M`, that is, $T G_M T^t = G_L$ where $G_M$
and $G_L$ are the Gram matrices of the (pseudo-)bases of `L` and `M`
respectively.
Setting the parameters `depth` and `bacher_depth` to a positive value may improve
performance. If set to `-1` (default), the used value of `depth` is chosen
heuristically depending on the rank of `L`. By default, `bacher_depth` is set to `0`.
"""
is_isometric_with_isometry(L::AbstractLat, M::AbstractLat; ambient_representation::Bool = true) = throw(NotImplemented())
is_isometric_with_isometry(L::AbstractLat, M::AbstractLat; ambient_representation::Bool = true, depth::Int = -1, bacher_depth::Int = 0) = throw(NotImplemented())


function is_isometric_with_isometry(L::AbstractLat{<: NumField}, M::AbstractLat{<: NumField};
ambient_representation::Bool = true)
ambient_representation::Bool = true, depth::Int = -1, bacher_depth::Int = 0)
V = ambient_space(L)
W = ambient_space(M)
E = base_ring(V)
Expand Down Expand Up @@ -1690,12 +1708,12 @@ function is_isometric_with_isometry(L::AbstractLat{<: NumField}, M::AbstractLat{
ZgramMsmall[i] = TM * ZgramM[i] * TMtr
end

fl, CLsmall, CMsmall = _try_iso_setup_small(ZgramLsmall, ZgramMsmall)
fl, CLsmall, CMsmall = _try_iso_setup_small(ZgramLsmall, ZgramMsmall, depth = depth, bacher_depth = bacher_depth)
if fl
b, _T = isometry(CLsmall, CMsmall)
T = matrix(FlintZZ, _T)
else
CL, CM = _iso_setup(ZgramLsmall, ZgramMsmall)
CL, CM = _iso_setup(ZgramLsmall, ZgramMsmall, depth = depth, bacher_depth = bacher_depth)
b, T = isometry(CL, CM)
end

Expand Down
Loading

0 comments on commit 97bd536

Please sign in to comment.