File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 9595
9696# Type can only represent elements of an exact ring
9797# true unless explicitly specified
98+ #
99+ # implementors should only implement this trait for RingElem subtypes, but for
100+ # convenience we support calling this also on Ring subtypes as well as Ring
101+ # and RingElem instances
98102is_exact_type (R:: Type{T} ) where T <: RingElem = true
99103
100- # Type can only represent elements of domains
104+ is_exact_type (x) = is_exact_type (typeof (x))
105+ is_exact_type (x:: Type{<:Ring} ) = is_exact_type (elem_type (x))
106+ is_exact_type (T:: DataType ) = throw (MethodError (is_exact_type, (T,)))
107+
108+ # Type can only represent elements of domains, i.e. without zero divisors
101109# false unless explicitly specified
110+ #
111+ # implementors should only implement this trait for RingElem subtypes, but for
112+ # convenience we support calling this also on Ring subtypes as well as Ring
113+ # and RingElem instances
102114is_domain_type (R:: Type{T} ) where T <: RingElem = false
103115
116+ is_domain_type (x) = is_domain_type (typeof (x))
117+ is_domain_type (x:: Type{<:Ring} ) = is_domain_type (elem_type (x))
118+ is_domain_type (T:: DataType ) = throw (MethodError (is_domain_type, (T,)))
119+
104120# ##############################################################################
105121#
106122# Exponential function for generic rings
You can’t perform that action at this time.
0 commit comments