Skip to content

Commit

Permalink
feat: minor improvements for residue maps (Nemocas#1563)
Browse files Browse the repository at this point in the history
- Some types in Nemo only do lift properly
- Sanity check for image function
  • Loading branch information
thofma authored Jan 23, 2024
1 parent af09200 commit 3aa8d1f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/generic/Residue.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ domain(f::EuclideanRingResidueMap) = f.domain
codomain(f::EuclideanRingResidueMap) = f.codomain

function image(f::EuclideanRingResidueMap, a)
parent(a) !== domain(f) && error("Not an element of the domain")
return codomain(f)(a)
end

(f::EuclideanRingResidueMap)(a) = image(f, a)

function preimage(f::EuclideanRingResidueMap, a)
parent(a) != codomain(f) && error("Not an element of the codomain")
return data(a)
return lift(a)
end

0 comments on commit 3aa8d1f

Please sign in to comment.