Skip to content

Commit

Permalink
Avoid R[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
fingolfin committed Jan 29, 2024
1 parent 907fb36 commit dede844
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/Modules/FreeModules-graded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ function tensor_product(G::FreeModule_dec...; task::Symbol = :none)
return Tuple(gen(G[i], t[e.r.pos[1]][i]) for i = 1:length(G))
end

return F, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), F, pure, inv_pure)
return F, MapFromFunc(Hecke.TupleParent(Tuple([zero(g) for g = G])), F, pure, inv_pure)
end

(G::ModuleFP_dec...) = tensor_product(G..., task = :none)
Expand Down
8 changes: 4 additions & 4 deletions src/Modules/ModulesGraded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ function graded_map(F::FreeMod{T}, A::MatrixElem{T}) where {T <: RingElement}
source_degrees = Vector{eltype(G)}()
for i in 1:nrows(A)
for j in 1:ncols(A)
if A[i, j] != R[0]
if !is_zero(A[i, j])
push!(source_degrees, degree(A[i, j]) + degree(F[j]))
break
end
Expand All @@ -580,7 +580,7 @@ function graded_map(F::FreeMod{T}, V::Vector{<:AbstractFreeModElem{T}}) where {T
source_degrees = Vector{eltype(G)}()
for i in 1:nrows
for j in 1:ncols
if coordinates(V[i])[j] != R[0]
if !is_zero(coordinates(V[i])[j])
push!(source_degrees, degree(coordinates(V[i])[j]) + degree(F[j]))
break
end
Expand All @@ -599,7 +599,7 @@ function graded_map(F::SubquoModule{T}, V::Vector{<:ModuleFPElem{T}}) where {T <
source_degrees = Vector{eltype(G)}()
for i in 1:nrows
for (j, coord_val) in coordinates(V[i])
if coord_val != R[0]
if !is_zero(coord_val)
push!(source_degrees, degree(coord_val) + degree(F[j]))
break
end
Expand Down Expand Up @@ -2246,7 +2246,7 @@ function tensor_product(G::FreeMod_dec...; task::Symbol = :none)
if task == :none
return F
end
return F, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), F, pure, inv_pure)
return F, MapFromFunc(Hecke.TupleParent(Tuple([zero(g) for g = G])), F, pure, inv_pure)
end


Expand Down
4 changes: 2 additions & 2 deletions src/Modules/UngradedModules/Tensor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function tensor_product(G::FreeMod...; task::Symbol = :none)
return F
end

return F, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), F, pure, inv_pure)
return F, MapFromFunc(Hecke.TupleParent(Tuple([zero(g) for g = G])), F, pure, inv_pure)
end

(G::ModuleFP...) = tensor_product(G..., task = :none)
Expand Down Expand Up @@ -163,7 +163,7 @@ function tensor_product(G::ModuleFP...; task::Symbol = :none)
return s
end

return s, MapFromFunc(Hecke.TupleParent(Tuple([g[0] for g = G])), s, pure)
return s, MapFromFunc(Hecke.TupleParent(Tuple([zero(g) for g = G])), s, pure)
end


1 change: 0 additions & 1 deletion test/Rings/mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ end
@test gen(F, 2) == F(y)
@test gens(F) == elem_type(F)[ F(x), F(y), F(z) ]
@test F[1] == F(x)
@test F[0] == zero(F)
end

@testset "Grassmann Plücker Relations" begin
Expand Down

0 comments on commit dede844

Please sign in to comment.