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

feat: adjust for upcoming indexing changes #3276

Merged
merged 2 commits into from
Jan 31, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ function _construct_literature_model_over_concrete_base(model_dict::Dict{String,

# Find divisor classes of the internal model sections
auxiliary_base_grading = matrix(ZZ, transpose(hcat([[eval_poly(weight, ZZ) for weight in vec] for vec in model_dict["model_data"]["auxiliary_base_grading"]]...)))
auxiliary_base_grading = vcat([[Int(k) for k in auxiliary_base_grading[i,:]] for i in 1:nrows(auxiliary_base_grading)]...)
auxiliary_base_grading = vcat([[Int(k) for k in auxiliary_base_grading[i:i,:]] for i in 1:nrows(auxiliary_base_grading)]...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not an objection, just trying to understand: presumably the old and new code will behave differently in the future? What will the difference be?

For Julia matrices, the difference is whether a vector or a matrix is returned. But we don't have dedicated vector objects, have we? Or is the plan to add them? (Ah, perhaps for a sparse matrix we'd be returning SRow versus SMat ?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It will just be a Vector (see the Linear algebra roadmap), so that the dimension of the indices now correspond to the dimension to the output (as for julia arrays).

  1. Nowadays we have more support for Matrix * Vector and solve(::Matrix, ::Vector) and things like that, which we did not have 5 years ago. So back then we avoided Vector at all costs.
  2. At the moment, it is cumbersome to get rows/columns as Vector. With the "new" indexing, it is easy: Just do [i, :]. To get it as a matrix, just do [[i], :] or [i:i, :].

internal_model_sections = Dict{String, ToricDivisor}()
for k in 2+length(model_sections):ngens(auxiliary_base_ring)
divisor = sum([auxiliary_base_grading[l,k] * model_sections_divisor_list[l] for l in 1:nrows(auxiliary_base_grading)])
Expand Down Expand Up @@ -399,7 +399,7 @@ function _construct_literature_model_over_arbitrary_base(model_dict::Dict{String

@req haskey(model_dict["model_data"], "auxiliary_base_grading") "Database does not specify auxiliary_base_grading, but is vital for model constrution, so cannot proceed"
auxiliary_base_grading = matrix(ZZ, transpose(hcat([[eval_poly(weight, ZZ) for weight in vec] for vec in model_dict["model_data"]["auxiliary_base_grading"]]...)))
auxiliary_base_grading = vcat([[Int(k) for k in auxiliary_base_grading[i,:]] for i in 1:nrows(auxiliary_base_grading)]...)
auxiliary_base_grading = vcat([[Int(k) for k in auxiliary_base_grading[i:i,:]] for i in 1:nrows(auxiliary_base_grading)]...)

base_dim = get(model_dict["model_data"], "base_dim", 3)

Expand Down
2 changes: 1 addition & 1 deletion experimental/FTheoryTools/src/auxiliary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function _ambient_space(base::NormalToricVariety, fiber_amb_space::NormalToricVa
a_rays[1:nrows(b_rays), 1:ncols(b_rays)] = b_rays
a_rays[1:nrows(b_rays), 1+ncols(b_rays):ncols(a_rays)] = transpose(u_matrix)
a_rays[1+nrows(b_rays):nrows(a_rays), 1+ncols(b_rays):ncols(a_rays)] = f_rays
a_cones = [hcat([b for b in b_cones[i,:]], [c for c in f_cones[j,:]]) for i in 1:nrows(b_cones), j in 1:nrows(f_cones)]
a_cones = [hcat([b for b in b_cones[i:i,:]], [c for c in f_cones[j:j,:]]) for i in 1:nrows(b_cones), j in 1:nrows(f_cones)]
a_space = normal_toric_variety(IncidenceMatrix(vcat(a_cones...)), a_rays; non_redundant = true)
set_coordinate_names(a_space, vcat(b_var_names, f_var_names))

Expand Down
2 changes: 1 addition & 1 deletion experimental/GITFans/src/GITFans.jl
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function fan_traversal(orbit_list::Vector{Vector{Cone{T}}}, q_cone::Cone{T}, per
neighbor_hashes = []
for i in 1:length(facet_points)
!any(f->facet_points[i] in f, facets(Cone, q_cone)) || continue
push!(neighbor_hashes, get_neighbor_hash(orbit_list, facet_points[i], Vector{T}([ic_facets[i, :]...])))
push!(neighbor_hashes, get_neighbor_hash(orbit_list, facet_points[i], Vector{T}([ic_facets[i:i, :]...])))
end

neighbor_hashes = [find_smallest_orbit_element(i, generators_new_perm, bitlist_oper_tuple, ==, less_or_equal_array_bitlist) for i in neighbor_hashes]
Expand Down
2 changes: 1 addition & 1 deletion experimental/GaloisGrp/src/Solve.jl
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ function conj_from_basis(C::GaloisCtx, S::SubField, a, pr)
for i=0:degree(S.fld)-1
d = conjugates(C, S.coeff_field, coeff(a, i), pr)
for j=1:length(d)
tmp[1, (j-1)*degree(S.fld)+1:j*degree(S.fld)] = d[j]*nb[i+1, (j-1)*degree(S.fld)+1:j*degree(S.fld)]
tmp[1, (j-1)*degree(S.fld)+1:j*degree(S.fld)] = d[j]*nb[i+1:i+1, (j-1)*degree(S.fld)+1:j*degree(S.fld)]
end
res += tmp
end
Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/src/CartanMatrix.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ function cartan_bilinear_form(gcm::ZZMatrix; check::Bool=true)
sym = cartan_symmetrizer(gcm; check)
bil = deepcopy(gcm)
for i in 1:length(sym)
mul!(view(bil, i, :), sym[i])
mul!(view(bil, i:i, :), sym[i])
end
return bil
end
Expand Down
2 changes: 1 addition & 1 deletion experimental/LieAlgebras/src/RootSystem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,7 @@ end
Reflects the `w` at the `s`-th simple root in place and returns `w`.
"""
function reflect!(w::WeightLatticeElem, s::Int)
addmul!(w.vec, view(cartan_matrix(root_system(w)), :, s), -w.vec[s])
addmul!(w.vec, view(cartan_matrix(root_system(w)), :, s:s), -w.vec[s])
return w
end

Expand Down
2 changes: 1 addition & 1 deletion experimental/QuadFormAndIsom/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ end
B = matrix(FlintQQ, 5, 5 ,[1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
G = matrix(FlintQQ, 5, 5 ,[3, 1, 0, 0, 0, 1, 3, 1, 1, -1, 0, 1, 3, 0, 0, 0, 1, 0, 3, 0, 0, -1, 0, 0, 3]);
L = integer_lattice(B, gram = G);
k = lattice_in_same_ambient_space(L, B[2, :])
k = lattice_in_same_ambient_space(L, B[2:2, :])
N = orthogonal_submodule(L, k)
ok, reps = primitive_extensions(k, N; glue_order=3)
@test ok
Expand Down
2 changes: 1 addition & 1 deletion experimental/Schemes/ToricIdealSheaves/constructors.jl
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function IdealSheaf(X::NormalToricVariety, I::MPolyIdeal)
for m in hilbert_basis(weight_cone(U))
img = one(help_ring)
for j in 1:length(indices)
u_rho = matrix(ZZ,rays(X))[indices[j],:]
u_rho = matrix(ZZ,rays(X))[indices[j]:(indices[j]),:]
expo = (u_rho*m)[1]
img = img * x_rho[j]^expo
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function is_semi_invariant_polynomial(rep::LinRep, f::S) where S <: MPolyDecRing
R1, R1toR = homogeneous_component(R, 1)
repd = dual_representation(rep)
for m in matrix_representation(repd)
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i,:]))) for i in 1:nrows(m)]
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i:i,:]))) for i in 1:nrows(m)]
fd = evaluate(f, poly_m)
ok, k = divides(fd, f)
if !ok || !is_constant(k)
Expand Down Expand Up @@ -48,7 +48,7 @@ function linear_representation(rep::LinRep, f::S) where S <: MPolyDecRingElem
repd = dual_representation(rep)
coll = eltype(matrix_representation(rep))[]
for m in matrix_representation(rep)
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i,:]))) for i in 1:nrows(m)]
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i:i,:]))) for i in 1:nrows(m)]
fd = evaluate(f, poly_m)
ok, k = divides(fd, f)
@req ok && is_constant(k) "Polynomial is not semi-invariant"
Expand All @@ -74,7 +74,7 @@ function is_invariant_ideal(rep::LinRep, I::S) where S <: MPolyIdeal{<: MPolyDec
R1, R1toR = homogeneous_component(R, 1)
repd = dual_representation(rep)
for f in gene for m in matrix_representation(repd)
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i,:]))) for i in 1:nrows(m)]
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i:i,:]))) for i in 1:nrows(m)]
fd = evaluate(f, poly_m)
fd in I || return false
end
Expand Down Expand Up @@ -147,7 +147,7 @@ function parametrization_data(symci::SymInter)
for (B, n) in pd
B2 = Vector{MPolyDecRingElem}[]
for b in B
vv = elem_type(S)[j(R(reverse_cols!(b[i,:]))) for i in 1:nrows(b)]
vv = elem_type(S)[j(R(reverse_cols!(b[i:i,:]))) for i in 1:nrows(b)]
push!(B2, vv)
end
push!(pd2, (B2, n))
Expand All @@ -169,7 +169,7 @@ function standard_element(symci::SymInter)
std_el2 = elem_type(S)[]
for B in std_el
for b in B
vv = elem_type(S)[j(R(reverse_cols!(b[i,:]))) for i in 1:nrows(b)]
vv = elem_type(S)[j(R(reverse_cols!(b[i:i,:]))) for i in 1:nrows(b)]
append!(std_el2, vv)
end
end
Expand Down
6 changes: 3 additions & 3 deletions experimental/SymmetricIntersections/src/representations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -894,7 +894,7 @@ function _action_symmetric_power(mr::Vector{AbstractAlgebra.Generic.MatSpaceElem
bsp = reverse!(RdtoR.(gens(Rd)))
coll = eltype(mr)[]
for m in mr
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i,:]))) for i in 1:nrows(m)]
poly_m = elem_type(R)[R1toR(R1(reverse_cols!(m[i:i,:]))) for i in 1:nrows(m)]
@assert length(poly_m) == n
m2 = zero_matrix(F, length(bsp), length(bsp))
for i = 1:length(bsp)
Expand Down Expand Up @@ -1278,8 +1278,8 @@ function complement_submodule(rep::LinRep{S, T, U}, M::W) where {S, T, U, W <: M
_K = zero_matrix(F, d*length(B1), d*length(B2))
for j in 1:length(B2)
B2j = B2[j]
B2jM = (B2j*M)[1,:]
B1u = reduce(vcat, [BB[1,:] for BB in B1])
B2jM = (B2j*M)[1:1,:]
B1u = reduce(vcat, [BB[1:1,:] for BB in B1])
_Kj = solve_left(B1u, B2jM)
for i in 1:d, k in 1:length(B1)
_K[(k-1)*d + i, i + (j-1)*d] = _Kj[1, k]
Expand Down
30 changes: 15 additions & 15 deletions src/AlgebraicGeometry/Surfaces/K3Auto.jl
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function BorcherdsCtx(L::ZZLat, S::ZZLat, weyl::ZZMatrix; compute_OR::Bool=true)
I = identity_matrix(QQ,degree(L))
# prS: L --> S^\vee given with respect to the standard basis of L and the basis of S
prS = ibSR*I[:,1:rank(S)]#*basis_matrix(S)
@assert prS[rank(S)+1,:]==0
@assert prS[[rank(S)+1],:]==0


if compute_OR
Expand Down Expand Up @@ -486,7 +486,7 @@ function _possible(D::K3Chamber, per, I, J)
end

for i in 1:I
if (vectorsj*T[:,i])[1,1] != gramB[J,per[i]]
if (vectorsj*T[:,i:i])[1,1] != gramB[J,per[i]]
good_scalar = false
break
end
Expand Down Expand Up @@ -617,7 +617,7 @@ function separating_hyperplanes(gram::QQMatrix, v::QQMatrix, h::QQMatrix, d)
ch = QQ((h*gram*transpose(h))[1,1])
cv = QQ((h*gram*transpose(v))[1,1])
b = basis_matrix(L)
prW = reduce(vcat,[b[i,:] - (b[i,:]*gram*transpose(h))*ch^-1*h for i in 1:n])
prW = reduce(vcat,[b[i:i,:] - (b[i:i,:]*gram*transpose(h))*ch^-1*h for i in 1:n])
W = lattice(ambient_space(L), prW, isbasis=false)
bW = basis_matrix(W)
# set up the quadratic triple for SW
Expand Down Expand Up @@ -747,7 +747,7 @@ function alg319(D::K3Chamber, E::K3Chamber)
k = nrows(img)
gi = gram*transpose(img)
for r in raysE
if (r*gram*transpose(r))[1,1] != gram_basis[k+1,k+1] || (k>0 && r*gi != gram_basis[k+1,1:k])
if (r*gram*transpose(r))[1,1] != gram_basis[k+1,k+1] || (k>0 && r*gi != gram_basis[k+1:k+1,1:k])
continue
end
# now r has the correct inner products with what we need
Expand Down Expand Up @@ -816,7 +816,7 @@ function alg319(gram::MatrixElem, basis::ZZMatrix, gram_basis::QQMatrix, raysD::
k = nrows(img)
gi = gram*transpose(img)
for r in raysE
if (r*gram*transpose(r))[1,1] != gram_basis[k+1,k+1] || (k>0 && r*gi != gram_basis[k+1,1:k])
if (r*gram*transpose(r))[1,1] != gram_basis[k+1,k+1] || (k>0 && r*gi != gram_basis[k+1:k+1,1:k])
continue
end
# now r has the correct inner products with what we need
Expand Down Expand Up @@ -1732,8 +1732,8 @@ function weyl_vector(L::ZZLat, U0::ZZLat)
v = (v + 2*x)*basis_matrix(R)
@hassert :K3Auto 1 mod(inner_product(V,v,v)[1,1], 8)==0
u = basis_matrix(U)
f1 = u[1,:]
e1 = u[2,:] + u[1,:]
f1 = u[1:1,:]
e1 = u[2:2,:] + u[1:1,:]
f2 = -inner_product(V, v, v)*1//4*f1 + 2*e1 + v
@hassert :K3Auto 1 inner_product(V, f2, f2)==0

Expand All @@ -1759,8 +1759,8 @@ function weyl_vector(L::ZZLat, U0::ZZLat)
@vprint :K3Auto 1 "found a lattice of minimum $(m) \n"
if m==4
# R is isomorphic to the Leech lattice
fu = basis_matrix(U)[1,:]
zu = basis_matrix(U)[2,:]
fu = basis_matrix(U)[1:1,:]
zu = basis_matrix(U)[2:2,:]
u0 = 3*fu+zu
return fu,u0
end
Expand All @@ -1770,8 +1770,8 @@ function weyl_vector(L::ZZLat, U0::ZZLat)
# with the attached hyperbolic planes this can be engineered to give an isometry
@hassert :K3Auto 1 mod(inner_product(V,v,v)[1,1],2*h^2)==0
u = basis_matrix(U)
f1 = u[1,:]
e1 = u[2,:] + u[1,:]
f1 = u[1:1,:]
e1 = u[2:2,:] + u[1:1,:]
f2 = -inner_product(V, v, v)*1//(2*h)*f1 + h*e1 + v
@hassert :K3Auto 1 inner_product(V, f2, f2)==0

Expand Down Expand Up @@ -1821,7 +1821,7 @@ function borcherds_method_preprocessing(S::ZZLat, n::Integer; ample=nothing)
u = u2*u1
@assert g2 == u*G*transpose(u)
B = u*basis_matrix(L)
B = vcat(B[1,:],B[end,:]-B[1,:])
B = vcat(B[1:1,:],B[end:end,:]-B[1:1,:])
if inner_product(V,B,B) != QQ[0 1; 1 -2]
# find an isotropic vector
if gram_matrix(S)[1,1]==0
Expand Down Expand Up @@ -1882,7 +1882,7 @@ function ample_class(S::ZZLat)
u = basis_matrix(S)[1:2,:]
if inner_product(V,u,u) == QQ[0 1; 1 -2]
h = zero_matrix(QQ,1,rank(S))
v = 3*u[1,:] + u[2,:]
v = 3*u[1:1,:] + u[2:2,:]
fudge = 1
nt = 0
while true
Expand Down Expand Up @@ -1913,7 +1913,7 @@ function ample_class(S::ZZLat)
G = gram_matrix(S)
D, B = Hecke._gram_schmidt(G,identity,true)
i = findfirst(x->x, [d>0 for d in diagonal(D)])
v = B[i,:]
v = B[i:i,:]
v = denominator(v)*v
vsq = (v*gram_matrix(S)*transpose(v))[1,1]
@assert vsq > 0
Expand Down Expand Up @@ -2020,7 +2020,7 @@ function find_section(L::ZZLat, f::QQMatrix)
g = [abs(i) for i in vec(collect(inner_product(ambient_space(L),f,basis_matrix(L))))]
if 1 in g
i = findfirst(x->x==1,g)
s = basis_matrix(L)[i,:]
s = basis_matrix(L)[i:i,:]
s = sign(inner_product(ambient_space(L),f,s)[1,1])*s
else
# search a smallish section using a cvp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,21 @@ function normal_toric_variety_from_star_triangulation(P::Polyhedron)
# Find position of origin in the lattices points of the polyhedron P
pts = matrix(ZZ, lattice_points(P))
zero = [0 for i in 1:ambient_dim(P)]
indices = findall(k -> pts[k,:] == matrix(ZZ, [zero]), 1:nrows(pts))
indices = findall(k -> pts[k:k,:] == matrix(ZZ, [zero]), 1:nrows(pts))
@req length(indices) == 1 "Polyhedron must contain origin (exactly once)"

# Change order of lattice points s.t. zero is the first point
tmp = pts[1,:]
pts[1,:] = pts[indices[1],:]
pts[indices[1],:] = tmp
tmp = pts[1:1,:]
pts[1:1,:] = pts[indices[1]:indices[1],:]
pts[indices[1]:indices[1],:] = tmp

# Find one triangulation and turn it into the maximal cones of the toric variety in question. Note that:
# (a) needs to be converted to incidence matrix
# (b) one has to remove origin from list of indices (as removed above)
max_cones = IncidenceMatrix([[c[i]-1 for i in 2:length(c)] for c in _find_full_star_triangulation(pts)])

# Rays are all but the zero vector at the first position of pts
integral_rays = reduce(vcat, [pts[k,:] for k in 2:nrows(pts)])
integral_rays = reduce(vcat, [pts[k:k,:] for k in 2:nrows(pts)])

# construct the variety
return normal_toric_variety(max_cones, integral_rays; non_redundant = true)
Expand Down Expand Up @@ -280,7 +280,7 @@ function normal_toric_varieties_from_star_triangulations(P::Polyhedron)
# find position of origin in the lattices points of the polyhedron P
pts = matrix(ZZ, lattice_points(P))
zero = [0 for i in 1:ambient_dim(P)]
indices = findall(k -> pts[k,:] == matrix(ZZ, [zero]), 1:nrows(pts))
indices = findall(k -> pts[k:k,:] == matrix(ZZ, [zero]), 1:nrows(pts))
@req length(indices) == 1 "Polyhedron must contain origin (exactly once)"

# change order of lattice points s.t. zero is the first point
Expand Down Expand Up @@ -408,7 +408,7 @@ function normal_toric_varieties_from_glsm(charges::ZZMatrix)
pts = vcat(matrix(QQ, transpose(zero)), matrix(QQ, pts))

# construct varieties
integral_rays = reduce(vcat, [pts[k,:] for k in 2:nrows(pts)])
integral_rays = reduce(vcat, [pts[k:k,:] for k in 2:nrows(pts)])
max_cones = [IncidenceMatrix([[c[i]-1 for i in 2:length(c)] for c in t]) for t in star_triangulations(pts; full = true)]
varieties = [normal_toric_variety(cones, integral_rays; non_redundant = true) for cones in max_cones]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Map
for i in 1:nrows(images)
v = [images[i,k] for k in 1:ncols(images)]
j = findfirst(x -> x == true, [(v in maximal_cones(cod)[j]) for j in 1:nmaxcones(cod)])
m = reduce(vcat, [Int(ray_indices(maximal_cones(cod))[j, k]) * cod_rays[k, :] for k in 1:nrays(cod)])
mapping_matrix = hcat(mapping_matrix, solve(transpose(m), transpose(images[i, :])))
m = reduce(vcat, [Int(ray_indices(maximal_cones(cod))[j, k]) * cod_rays[k:k, :] for k in 1:nrays(cod)])
mapping_matrix = hcat(mapping_matrix, solve(transpose(m), transpose(images[i:i, :])))
end
return hom(torusinvariant_weil_divisor_group(d), torusinvariant_weil_divisor_group(cod), transpose(mapping_matrix))
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ end

# Write the elements in `degs2` as linear combinations of `degs1`, allowing only non-negative
# coefficients for the vectors vᵢ of `degs1` with index i ∈ `non_local_indices`.
function _convert_degree_system(degs1::ZZMatrix, degs2::ZZMatrix, non_local_indices_1::Vector{Int64})
function _convert_degree_system(degs1::ZZMatrix, degs2::ZZMatrix, non_local_indices_1::Vector{Int})
result = Vector{ZZMatrix}()
for i in 1:nrows(degs2)
C = identity_matrix(ZZ, nrows(degs1))[non_local_indices_1,:]
S = solve_mixed(transpose(degs1), transpose(degs2[i,:]), C; permit_unbounded=true)
push!(result, S[1, :])
S = solve_mixed(transpose(degs1), transpose(degs2[i:i,:]), C; permit_unbounded=true)
push!(result, S[1:1, :])
end
return result
end
Expand Down
10 changes: 5 additions & 5 deletions src/Groups/matrices/FiniteFormOrthogonalGroup.jl
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,14 @@ function _lift(q::T, f::T, a) where T <: Union{ZZModMatrix, zzModMatrix}
if mod(lift(q[end-1,end-1] + q[end,end]), 4) == 2
g[end, end-1] = a
g[1:end-2,end-1] = diagonal(divexact(G - f*G*transpose(f),2))
g[end,1:end-2] = transpose(fGinv * g[1:end-2,end-1])
g[end:end,1:end-2] = transpose(fGinv * g[1:end-2,end-1:end-1])
else
if a == 0
a = zeros(R, ncols(q)-2)
end
g[1:end-2,end-1] = a
g[end,1:end-2] = transpose(fGinv * g[1:end-2,end-1])
t = (g[end,1:end-2]*G*transpose(g[end,1:end-2]))[1,1]
g[[end],1:end-2] = transpose(fGinv * g[1:end-2,end-1:end-1])
t = (g[end:end,1:end-2]*G*transpose(g[end:end,1:end-2]))[1,1]
g[end,end-1] = divexact(t-mod(lift(t), 2), 2)
end
err = g*qb*transpose(g)-qb
Expand Down Expand Up @@ -642,9 +642,9 @@ function _ker_gens(G::Union{ZZModMatrix, zzModMatrix}, i1, i2, parity)
end
if parity[1]==1 && parity[3]==1
# compensate
g[e+1, i1] = divexact((g[e+1,i1+1:i2]*G[i1+1:i2,i1+1:i2]*transpose(g[e+1,i1+1:i2]))[1,1],4)
g[e+1, i1] = divexact((g[e+1:e+1,i1+1:i2]*G[i1+1:i2,i1+1:i2]*transpose(g[e+1:e+1,i1+1:i2]))[1,1],4)
# the second row depends on the third
g[i1+1:i2,i1] = - divexact((G[i1+1:i2,i1+1:i2]* transpose(g[i2+1:end,i1+1:i2]) * inv(G[i2+1:end,i2+1:end]))[:,end], 2)
g[i1+1:i2,i1:i1] = - divexact((G[i1+1:i2,i1+1:i2]* transpose(g[i2+1:end,i1+1:i2]) * inv(G[i2+1:end,i2+1:end]))[:,end:end], 2)
end
if g[i,j] == 1 # no need to append the identity
push!(gens, g)
Expand Down
2 changes: 1 addition & 1 deletion src/Groups/matrices/iso_nf_fq.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function test_modulus(matrices::Vector{T}, p::Int) where T <: MatrixElem{nf_elem
# I don't want to invert everything in char 0, so I just check whether the
# matrices are still invertible mod p.
for i = 1:length(matrices)
matrices_Fq[i] = matrix(Fq, [ OtoFq(O(numerator(a)))//OtoFq(O(denominator(a))) for a in matrices[i] ])
matrices_Fq[i] = map_entries(a -> OtoFq(O(numerator(a)))//OtoFq(O(denominator(a))), matrices[i])
if rank(matrices_Fq[i]) != nrows(matrices_Fq[i])
return false, Fq, matrices_Fq, Hecke.NfOrdToFqMor()
end
Expand Down
Loading
Loading