Skip to content

Commit

Permalink
Fix Grassmann Pluecker (#3382)
Browse files Browse the repository at this point in the history
* fixed

* fix for symmetric intersections test

* back to the roots

* revert

* Apply suggestions from code review

Co-authored-by: Benjamin Lorenz <benlorenz@users.noreply.github.com>

---------

Co-authored-by: Tommy Hofmann <thofma@gmail.com>
Co-authored-by: Benjamin Lorenz <benlorenz@users.noreply.github.com>
  • Loading branch information
3 people committed Feb 19, 2024
1 parent 3f1dec4 commit 7433548
Showing 1 changed file with 24 additions and 18 deletions.
42 changes: 24 additions & 18 deletions src/Rings/mpoly-ideals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1922,7 +1922,15 @@ small_generating_set(I::MPolyIdeal{<:MPolyDecRingElem}) = minimal_generating_set
#
################################################################################
function grassmann_pluecker_ideal(subspace_dimension::Int, ambient_dimension::Int)
return convert(MPolyIdeal{QQMPolyRingElem}, Polymake.ideal.pluecker_ideal(subspace_dimension, ambient_dimension))
I = convert(MPolyIdeal{QQMPolyRingElem},
Polymake.ideal.pluecker_ideal(subspace_dimension, ambient_dimension))
base = base_ring(I)
o = degrevlex(base)

return ideal(IdealGens(base, gens(I), o;
keep_ordering=true,
isReduced=true,
isGB=true))
end

@doc raw"""
Expand All @@ -1944,33 +1952,31 @@ julia> grassmann_pluecker_ideal(2, 4)
Ideal generated by
x[1]*x[6] - x[2]*x[5] + x[3]*x[4]
julia> R, x = polynomial_ring(residue_ring(ZZ, 7)[1], "x" => (1:2, 1:3), ordering=:degrevlex)
julia> R, x = polynomial_ring(residue_ring(ZZ, 7)[1], "x" => (1:2, 1:3))
(Multivariate polynomial ring in 6 variables over ZZ/(7), zzModMPolyRingElem[x[1, 1] x[1, 2] x[1, 3]; x[2, 1] x[2, 2] x[2, 3]])
julia> grassmann_pluecker_ideal(R, 2, 4)
Ideal generated by
x[1, 2]*x[2, 2] + 6*x[2, 1]*x[1, 3] + x[1, 1]*x[2, 3]
x[1, 1]*x[2, 3] + 6*x[2, 1]*x[1, 3] + x[1, 2]*x[2, 2]
```
"""
function grassmann_pluecker_ideal(ring::MPolyRing,
subspace_dimension::Int,
ambient_dimension::Int)
pluecker_ideal = grassmann_pluecker_ideal(subspace_dimension, ambient_dimension)
converted_generators = elem_type(ring)[]
coeff_ring = base_ring(ring)
for g in gens(pluecker_ideal)
converted_coeffs = [coeff_ring(numerator(c)) for c in AbstractAlgebra.coefficients(g)]
polynomial = MPolyBuildCtx(ring)

for (i, exponent) in enumerate(AbstractAlgebra.exponent_vectors(g))
c = converted_coeffs[i]
push_term!(polynomial, c, exponent)
end
converted_g = finish(polynomial)
push!(converted_generators, converted_g)
end
return ideal(ring, converted_generators)
I = grassmann_pluecker_ideal(subspace_dimension, ambient_dimension)
coeff_ring = base_ring(ring)
o = degrevlex(ring)
coeffmap = c -> begin
@assert is_integral(c)
return coeff_ring(numerator(c))
end
h = hom(base_ring(I), ring, coeffmap, gens(ring))
converted_generators = elem_type(ring)[h(g) for g in groebner_basis(I; ordering = degrevlex(base_ring(I)))]
ideal(IdealGens(ring, converted_generators, o;
keep_ordering=true,
isReduced=true,
isGB=true))
end

################################################################################
Expand Down

0 comments on commit 7433548

Please sign in to comment.