Open fredrik-johansson opened 7 months ago
Disadvantages:
- There would be a performance hit working with $R^{*}$ or $R^$ instead of $R$ (due to needing to wrap and inspect elements). But surely this isn't the use case to optimize for? Normally, you'd want to use $R^{*}$ or $R^$ only where it is convenient, and do your actual number crunching in $R$.
I agree, but it would have to be done case by case, I believe? Otherwise there may be, as you imply, unwanted overhead.
For a generic ring $R$ (or other structure, where relevant), we can define:
Undefined
element, but we can also add more refined extended values like infinities.Unknown
meta-element.This is currently only done for
ca_t
(https://flintlib.org/doc/ca.html#introduction-special-values; see also https://fredrikj.net/blog/2021/01/infinity-in-calcium-and-fungrim/) and less formally forarf_t
forarb_t
, where NaN stands forUndefined
orUnknown
depending on context.It would be better to do this with a generic construction that wraps any given ring R. By default, operations could simply intercept
GR_UNABLE
(turning them intoUnknown
) andGR_DOMAIN
(turning them intoUndefined
). This could be refined with infinity handling for special functions likegr_exp
over rings where infinities make sense.Advantages:
GR_UNABLE
/GR_DOMAIN
) over arbitrary rings.Disadvantages: