Skip to content

Commit

Permalink
Clean up redundant mul! methods
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Sep 16, 2024
1 parent 25a581c commit bb26fa7
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 39 deletions.
11 changes: 3 additions & 8 deletions src/Groups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ end
# Mutable API where modifications are recommended for performance reasons
################################################################################

# further mutable functions in fundamental_interface.jl:
# mul!(out::T, g::T, h::T) where {T<:GroupElem} = g * h

"""
one!(g::GroupElem)
Expand All @@ -251,14 +254,6 @@ allowed.
"""
inv!(out::T, g::T) where {T<:GroupElem} = inv(g)

"""
mul!(out::T, g::T, h::T) where {GEl <: GroupElem}
Return `g*h`, possibly modifying `out`. Aliasing of `g` or `h` with `out` is
allowed.
"""
mul!(out::T, g::T, h::T) where {T<:GroupElem} = g * h

"""
div_right!(out::T, g::T, h::T) where {GEl <: GroupElem}
Expand Down
4 changes: 0 additions & 4 deletions src/NCRings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ Base.:\(y::Union{Integer, Rational, AbstractFloat}, x::NCRingElem) = divexact_le

Base.literal_pow(::typeof(^), x::NCRingElem, ::Val{p}) where {p} = x^p

function mul!(z::T, x::T, y::T) where T <: NCRingElem
return x*y
end

function addmul!(z::T, x::T, y::T, c::T) where T <: NCRingElem
c = mul!(c, x, y)
z = addeq!(z, c)
Expand Down
4 changes: 0 additions & 4 deletions src/algorithms/MPolyEvaluate.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
#
###############################################################################

function mul!(z::T, a, b)::T where T
return a*b
end

function pow!(z::T, a, b)::T where T
return a^b
end
Expand Down
3 changes: 2 additions & 1 deletion src/generic/FactoredFraction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,9 @@ function zero!(c::FactoredFracFieldElem)
return c
end

# needed as mul!(c::FracElem{T}, a::FracElem{T}, b::FracElem{T}) is incompatible
function mul!(c::FactoredFracFieldElem{T}, a::FactoredFracFieldElem{T}, b::FactoredFracFieldElem{T}) where T <: RingElement
return a*b
return a*b
end

function addeq!(a::FactoredFracFieldElem{T}, b::FactoredFracFieldElem{T}) where T <: RingElement
Expand Down
5 changes: 0 additions & 5 deletions src/generic/MatRing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,6 @@ end
#
###############################################################################

function mul!(A::MatRingElem{T}, B::MatRingElem{T},
C::MatRingElem{T}) where T <: NCRingElement
return B*C
end

function addeq!(A::MatRingElem{T}, B::MatRingElem{T}) where T <: NCRingElement
n = degree(A)
for i = 1:n
Expand Down
2 changes: 0 additions & 2 deletions src/generic/Misc/Localization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ Poly: deg(N(a/b)), rest the same
#
###############################################################################

mul!(c::LocalizedEuclideanRingElem, a::LocalizedEuclideanRingElem, b::LocalizedEuclideanRingElem) = a * b

addeq!(a::LocalizedEuclideanRingElem, b::LocalizedEuclideanRingElem) = a + b

###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion src/generic/UnivPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1012,7 +1012,7 @@ function add!(a::UnivPoly{T}, b::UnivPoly{T}, c::UnivPoly{T}) where {T <: RingEl
end

function mul!(a::UnivPoly{T}, b::UnivPoly{T}, c::UnivPoly{T}) where {T <: RingElement}
a.p = (b*c).p
a.p = mul!(a.p, b.p, c.p)
return a
end

Expand Down
4 changes: 0 additions & 4 deletions src/julia/Float.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ end
# See #1077


function mul!(a::T, b::T, c::T) where T <: AbstractFloat
return b*c
end

function addmul!(a::T, b::T, c::T, d::T) where T <: AbstractFloat
return a + b*c
end
Expand Down
4 changes: 0 additions & 4 deletions src/julia/GF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -360,10 +360,6 @@ function zero!(z::GFElem{T}) where T <: Integer
return GFElem{T}(d, R)
end

function mul!(z::GFElem{T}, x::GFElem{T}, y::GFElem{T}) where T <: Integer
return x*y
end

function mul!(z::GFElem{BigInt}, x::GFElem{BigInt}, y::GFElem{BigInt})
R = parent(x)
p = R.p::BigInt
Expand Down
4 changes: 0 additions & 4 deletions src/julia/Integer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -540,10 +540,6 @@ end
# See #1077


function mul!(a::T, b::T, c::T) where T <: Integer
return b*c
end

function addmul!(a::T, b::T, c::T, d::T) where T <: Integer
return a + b*c
end
Expand Down
2 changes: 0 additions & 2 deletions src/julia/Rational.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ function addmul!(a::Rational{T}, b::Rational{T}, c::Rational{T}, d::Rational{T})
return a
end

mul!(z::Rational{T}, x::Rational{T}, y::T) where T <: Integer = x * y

###############################################################################
#
# Random generation
Expand Down

0 comments on commit bb26fa7

Please sign in to comment.