Skip to content

Commit

Permalink
use check_parent helper in ring interface example (#1774)
Browse files Browse the repository at this point in the history
  • Loading branch information
SoongNoonien authored Aug 22, 2024
1 parent 747ce71 commit b5a71a0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/src/ring_interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -917,32 +917,32 @@ end
# Binary operations

function +(f::ConstPoly{T}, g::ConstPoly{T}) where T <: RingElement
parent(f) != parent(g) && error("Incompatible rings")
check_parent(f, g)
R = parent(f)
return R(f.c + g.c)
end

function -(f::ConstPoly{T}, g::ConstPoly{T}) where T <: RingElement
parent(f) != parent(g) && error("Incompatible rings")
check_parent(f, g)
R = parent(f)
return R(f.c - g.c)
end

function *(f::ConstPoly{T}, g::ConstPoly{T}) where T <: RingElement
parent(f) != parent(g) && error("Incompatible rings")
check_parent(f, g)
R = parent(f)
return R(f.c*g.c)
end

# Comparison

function ==(f::ConstPoly{T}, g::ConstPoly{T}) where T <: RingElement
parent(f) != parent(g) && error("Incompatible rings")
check_parent(f, g)
return f.c == g.c
end

function isequal(f::ConstPoly{T}, g::ConstPoly{T}) where T <: RingElement
parent(f) != parent(g) && error("Incompatible rings")
check_parent(f, g)
return isequal(f.c, g.c)
end

Expand All @@ -951,7 +951,7 @@ end
# Exact division

function divexact(f::ConstPoly{T}, g::ConstPoly{T}; check::Bool = true) where T <: RingElement
parent(f) != parent(g) && error("Incompatible rings")
check_parent(f, g)
R = parent(f)
return R(divexact(f.c, g.c, check = check))
end
Expand Down

0 comments on commit b5a71a0

Please sign in to comment.