-
-
Notifications
You must be signed in to change notification settings - Fork 528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move generic ring methods to category #31722
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Commit: |
comment:4
I am a -1 on doing this. You are changing a Cython function into a Python function (which can be further called indirectly) and this check is done in some parts that need to be fast. The This is suggesting that more rings inherit from New commits:
|
comment:7
Replying to @tscrim:
Wait a second...but |
comment:8
Methods in a Cython file are faster than those in plain python files. |
comment:9
But then we can still overwrite the category's class and obtain the same speed, no? |
comment:11
I turned After that, I added I mean, this cannot only happen to magmas. Is there any way to handle this properly? |
comment:12
Next steps: reduce the usage of |
comment:14
What is the point of reducing the usage of |
comment:15
See eg #28189 |
comment:16
Typical example
|
comment:17
Replying to @videlec:
See Travis's comment: #31713 comment:17. There are a lot of files that nail |
comment:18
Replying to @mjungmath:
I strongly agree that unification is required. I don't see why |
comment:19
Alright. Could you elaborate on this a bit more? I naively thought |
comment:20
I just think that this requires more thoughts. It is good to have your branch as a "proof of concept" but I think this would be better discussed on sage-devel. Note that your implementation of |
comment:21
Replying to @videlec:
Alright, I'll open a thread.
I agree, and I am not satisfied with that either. But for now I just copied the code from |
comment:22
What I could imagine is that |
comment:23
Replying to @mjungmath:
The idea is nice but the realization is less nice. By refining the category you change the classes of parents and elements (except if it is an extension class). Namely, the following construction is not commutative
versus
Maybe even worse, the following scenario ends up with two elements having different classes
|
comment:24
But that would mean that the parent must already take care of its categories during initialization such that If that is the case, the implementation of And the implementation of the category of magmas would be a violation of the above concept, i.e. a flawed implementation. |
This comment has been minimized.
This comment has been minimized.
comment:26
Replying to @mjungmath:
Or at least before any element is created.
That becomes annoying for
|
comment:27
However, that being said, most parents take care of their category correctly. The |
comment:28
Replying to @videlec:
Not a big issue, isn't it? A parent is still allowed to overwrite the category's method. But honestly, I don't quite get your initial argument. Why can't a parent be in the category of fields and maintain the original ring implementation? Usually, the element class stays the same whereas only the category changes, or do I get something wrong here? As far as I understand the category framework, categories and concrete implementations are entirely decoupled. Do you have a concrete example where this might fail? |
comment:29
Replying to @mjungmath:
As we all know, you need to determine if |
All generic methods such as
ìs_field
oris_integral_domain
, which are commonly used all over Sage, are part ofrings/ring.pyx
. But not every ring inherits from it.I suggest to move those method to
categories/rings.py
. This allows to replace any_Fields = Fields()
allocation andif R in _Fields
clauses by a simpler and quickerR.is_field()
check.sage-devel discussion: https://groups.google.com/g/sage-devel/c/H0lih8_3_o4
CC: @tscrim @mkoeppe @videlec @slel
Component: categories
Branch/Commit: u/gh-mjungmath/move_generic_ring_methods_to_category @
1af973d
Issue created by migration from https://trac.sagemath.org/ticket/31722
The text was updated successfully, but these errors were encountered: