Skip to content

Commit

Permalink
Move methods from AA.* to Base.*
Browse files Browse the repository at this point in the history
the `AA.*` should only implement methods for julia types and delegate everything else
  • Loading branch information
lgoettgens committed Oct 2, 2024
1 parent a17088e commit d7eb617
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/Fields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ is_zero_divisor(a::T) where T <: FieldElem = is_zero(a)

Base.divrem(a::T, b::T) where {T <: FieldElem} = divexact(a, b), zero(parent(a))

div(a::T, b::T) where {T <: FieldElem} = divexact(a, b)
Base.div(a::T, b::T) where {T <: FieldElem} = divexact(a, b)

Check warning on line 19 in src/Fields.jl

View check run for this annotation

Codecov / codecov/patch

src/Fields.jl#L19

Added line #L19 was not covered by tests

function gcd(x::T, y::T) where {T <: FieldElem}
check_parent(x, y)
Expand Down
5 changes: 0 additions & 5 deletions src/Poly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1479,11 +1479,6 @@ function Base.divrem(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: RingElem
return q, f
end

function Base.div(f::PolyRingElem{T}, g::PolyRingElem{T}) where T <: RingElement
q, r = divrem(f, g)
return q
end

##############################################################################
#
# Ad hoc Euclidean division
Expand Down
4 changes: 2 additions & 2 deletions src/generic/LaurentMPoly.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ function is_gen(a::LaurentMPolyWrap)
return !iszero(_var_index(a))
end

function inv(a::LaurentMPolyWrap)
function Base.inv(a::LaurentMPolyWrap)
(ap, ad) = _normalize(a)
return LaurentMPolyWrap(parent(a), inv(ap), neg!(ad, ad))
end
Expand Down Expand Up @@ -204,7 +204,7 @@ function gcd(a::LaurentMPolyWrap, b::LaurentMPolyWrap)
return LaurentMPolyWrap(parent(a), gcd(ap, bp), zero!(ad))
end

function divrem(a::LaurentMPolyWrap, b::LaurentMPolyWrap)
function Base.divrem(a::LaurentMPolyWrap, b::LaurentMPolyWrap)
check_parent(a, b)
error("divrem not implemented for LaurentMPoly")
end
Expand Down
4 changes: 0 additions & 4 deletions src/generic/Misc/Localization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,6 @@ function Base.divrem(a::LocalizedEuclideanRingElem{T}, b::LocalizedEuclideanRing
end
end

function Base.div(a::LocalizedEuclideanRingElem{T}, b::LocalizedEuclideanRingElem{T}) where {T}
return divrem(a, b)[1]
end

function rem(a::LocalizedEuclideanRingElem{T}, b::LocalizedEuclideanRingElem{T}) where {T}
return divrem(a, b)[2]
end
Expand Down

0 comments on commit d7eb617

Please sign in to comment.