Skip to content

Commit

Permalink
Remove obsolete getindex methods for accessing generators
Browse files Browse the repository at this point in the history
AA defines this generically
  • Loading branch information
fingolfin committed Jan 29, 2024
1 parent fb1698f commit 4a90e9a
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 55 deletions.
1 change: 0 additions & 1 deletion experimental/GModule/Brueckner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,6 @@ function brueckner(mQ::Map{<:Oscar.GAPGroup, PcGroup}; primes::Vector=[])
return allR
end

Base.getindex(M::AbstractAlgebra.FPModule, i::Int) = i==0 ? zero(M) : gens(M)[i]
Oscar.gen(M::AbstractAlgebra.FPModule, i::Int) = M[i]

Oscar.is_free(M::Generic.FreeModule) = true
Expand Down
1 change: 0 additions & 1 deletion src/Groups/GAPGroups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ function gen(G::GAPGroup, i::Int)
@assert length(L) >= i "The number of generators is lower than the given index"
return group_element(G, L[i]::GapObj)
end
Base.getindex(G::GAPGroup, i::Int) = gen(G, i)

"""
ngens(G::GAPGroup) -> Int
Expand Down
2 changes: 0 additions & 2 deletions src/Groups/matrices/matrix_manipulation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ end
#
########################################################################

Base.getindex(V::AbstractAlgebra.Generic.FreeModule, i::Int) = gen(V, i)


Base.:*(v::AbstractAlgebra.Generic.FreeModuleElem{T},x::MatElem{T}) where T <: RingElem = v.parent(v.v*x)
Base.:*(x::MatElem{T},u::AbstractAlgebra.Generic.FreeModuleElem{T}) where T <: RingElem = x*transpose(u.v)
Expand Down
10 changes: 0 additions & 10 deletions src/Modules/FreeModules-graded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,6 @@ function gen(F::FreeModule_dec, i::Int)
return FreeModuleElem_dec(s, F)
end

function Base.getindex(F::FreeModule_dec, i::Int)
i == 0 && return zero(F)
return gen(F, i)
end

base_ring(F::FreeModule_dec) = F.R

#TODO: Parent - checks everywhere!!!
Expand Down Expand Up @@ -705,11 +700,6 @@ function Base.iszero(F::SubquoDecModule)
return all(iszero, gens(F))
end

function Base.getindex(F::SubquoDecModule, i::Int)
i == 0 && return zero(F)
return gen(F, i)
end

function Base.iterate(F::BiModArray, i::Int = 1)
if i>length(F)
return nothing
Expand Down
5 changes: 0 additions & 5 deletions src/Modules/UngradedModules/FreeModElem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@ function basis(F::AbstractFreeMod, i::Int)
end
gen(F::AbstractFreeMod, i::Int) = basis(F,i)

function getindex(F::AbstractFreeMod, i::Int)
i == 0 && return zero(F)
return gen(F, i)
end

@doc raw"""
base_ring(F::AbstractFreeMod)
Expand Down
10 changes: 0 additions & 10 deletions src/Modules/UngradedModules/SubquoModuleElem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -899,16 +899,6 @@ function is_zero(M::SubquoModule)
return all(iszero, gens(M))
end

@doc raw"""
getindex(F::SubquoModule, i::Int)
Return the `i`th generator of `F`.
"""
function getindex(F::SubquoModule, i::Int)
i == 0 && return zero(F)
return gen(F, i)
end

function iterate(F::ModuleGens, i::Int = 1)
if i>length(F)
return nothing
Expand Down
2 changes: 0 additions & 2 deletions src/Rings/MPolyQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ end
gens(Q::MPolyQuoRing) = [Q(x) for x = gens(base_ring(Q))]
ngens(Q::MPolyQuoRing) = ngens(base_ring(Q))
gen(Q::MPolyQuoRing, i::Int) = Q(gen(base_ring(Q), i))
Base.getindex(Q::MPolyQuoRing, i::Int) = Q(base_ring(Q)[i])::elem_type(Q)
base_ring(Q::MPolyQuoRing) = base_ring(Q.I)
coefficient_ring(Q::MPolyQuoRing) = coefficient_ring(base_ring(Q))
modulus(Q::MPolyQuoRing) = Q.I
Expand Down Expand Up @@ -347,7 +346,6 @@ function gens(a::MPolyQuoIdeal)
end

gen(a::MPolyQuoIdeal, i::Int) = a.gens.Ox(a.gens.O[i])
getindex(a::MPolyQuoIdeal, i::Int) = gen(a, i)

@doc raw"""
ngens(a::MPolyQuoIdeal)
Expand Down
6 changes: 0 additions & 6 deletions src/Rings/PBWAlgebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,6 @@ function gen(R::PBWAlgRing, i::Int)
return PBWAlgElem(R, gen(R.sring, i))
end

function Base.getindex(R::PBWAlgRing, i::Int)
return gen(R, i)
end

function var_index(a::PBWAlgElem)
return Singular.var_index(a.sdata)
end
Expand Down Expand Up @@ -617,8 +613,6 @@ function gen(a::PBWAlgIdeal, i::Int)
return PBWAlgElem(R, a.sdata[i])
end

getindex(I::PBWAlgIdeal, i::Int) = gen(I, i)

function expressify(a::PBWAlgIdeal{D}; context = nothing) where D
dir = D < 0 ? :left_ideal : D > 0 ? :right_ideal : :two_sided_ideal
return Expr(:call, dir, [expressify(g, context = context) for g in gens(a)]...)
Expand Down
4 changes: 0 additions & 4 deletions src/Rings/PBWAlgebraQuo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ function gen(Q::PBWAlgQuo, i::Int)
return PBWAlgQuoElem(Q, PBWAlgElem(Q.I.basering, gen(Q.sring, i)))
end

function Base.getindex(Q::PBWAlgQuo, i::Int)
return gen(Q, i)
end

function zero(Q::PBWAlgQuo)
return PBWAlgQuoElem(Q, PBWAlgElem(Q.I.basering, zero(Q.sring)))
end
Expand Down
1 change: 0 additions & 1 deletion src/Rings/mpoly-graded.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1135,7 +1135,6 @@ base_ring(W::MPolyDecRing) = base_ring(forget_decoration(W))
Nemo.ngens(W::MPolyDecRing) = Nemo.ngens(forget_decoration(W))
Nemo.gens(W::MPolyDecRing) = map(W, gens(forget_decoration(W)))
Nemo.gen(W::MPolyDecRing, i::Int) = W(gen(forget_decoration(W), i))
Base.getindex(W::MPolyDecRing, i::Int) = W(forget_decoration(W)[i])

base_ring(f::MPolyDecRingElem) = base_ring(forget_decoration(f))

Expand Down
1 change: 0 additions & 1 deletion src/Rings/mpoly-ideals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,6 @@ function gens(I::MPolyIdeal)
end

gen(I::MPolyIdeal, i::Int) = I.gens[Val(:O), i]
getindex(I::MPolyIdeal, i::Int) = gen(I, i)

#######################################################
@doc raw"""
Expand Down
1 change: 0 additions & 1 deletion src/Rings/mpoly-localizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,6 @@ end
### required getter functions
gens(I::MPolyLocalizedIdeal) = copy(I.gens)
gen(I::MPolyLocalizedIdeal, i::Int) = I.gens[i]
getindex(I::MPolyLocalizedIdeal, i::Int) = I.gens[i]
base_ring(I::MPolyLocalizedIdeal) = I.W

### type getters
Expand Down
10 changes: 0 additions & 10 deletions src/Rings/mpoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ function _variables_for_singular(n::Int)
end
_variables_for_singular(S::Vector{Symbol}) = _variables_for_singular(length(S))

function Base.getindex(R::MPolyRing, i::Int)
i == 0 && return zero(R)
return gen(R, i)
end

ngens(F::AbstractAlgebra.Generic.FracField{T}) where {T <: MPolyRingElem} = ngens(base_ring(F))

function gen(F::AbstractAlgebra.Generic.FracField{T}) where {T <: PolyRingElem}
Expand All @@ -39,11 +34,6 @@ function gens(F::AbstractAlgebra.Generic.FracField{T}) where {T <: Union{PolyRin
return map(F, gens(base_ring(F)))
end

function Base.getindex(F::AbstractAlgebra.Generic.FracField{T}, i::Int) where {T <: MPolyRingElem}
i == 0 && return zero(F)
return gen(F, i)
end

######################################################################
# pretty printing for iJulia notebooks..
#
Expand Down
1 change: 0 additions & 1 deletion src/Rings/mpolyquo-localizations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,6 @@ end
### required getter functions
gens(I::MPolyQuoLocalizedIdeal) = copy(I.gens)
gen(I::MPolyQuoLocalizedIdeal, i::Int) = I.gens[i]
getindex(I::MPolyQuoLocalizedIdeal, i::Int) = I.gens[i]
base_ring(I::MPolyQuoLocalizedIdeal) = I.W

### additional getter functions
Expand Down

0 comments on commit 4a90e9a

Please sign in to comment.