-
-
Notifications
You must be signed in to change notification settings - Fork 487
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
Meta-ticket: Immutability for manifold objects #30261
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Dependencies: #30181 |
comment:6
I haven't found any active use of the There is another issue, I have encountered due to the dependence of #30181. I simply changed the following lines in -from sage.structure.element import ModuleElement
+from sage.structure.element import ModuleElementWithMutability
-class TensorField(ModuleElement):
+class TensorField(ModuleElementWithMutability):
- ModuleElement.__init__(self, parent)
+ super().__init__(parent) and I get the following error message:
|
comment:7
If you |
comment:8
Replying to @mjungmath:
Strong -1 This is a mixin class. Just add it to your inheritance. You don't have any Cython classes, so you can use multiple inheritance without any issues. I don't expect too many cases where having Cython is useful for elements with mutabiliy.
-1 All of the ABCs for the elements are in |
comment:9
Replying to @tscrim:
You mean -class AffineConnection(SageObject):
+class AffineConnection(SageObject, Mutability): Why is it working in this case?
Alright, that makes sense. The inheritance above seems to cause some trouble, I think due to the
|
comment:10
Replying to @mjungmath:
No. A Cython class cannot inherit from multiple things, but a Python class (as you have here) can. The classes it inherits from can both be Cython classes.
Yes, but not because it does not inherit from |
comment:11
Replying to @tscrim:
I'm confused because -class FreeModuleTensor(ModuleElement):
+class FreeModuleTensor(ModuleElement, Mutability): won't work. What is the difference? Is it because
Mh. Should I then overload |
This comment has been minimized.
This comment has been minimized.
comment:14
Let's work step-wise here. Scalar fields made no problem, I have created a new ticket devoted to them: #30266. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:18
Replying to @mjungmath:
Won't work how? The difference with what? The pickling/
You should overload |
comment:19
Replying to @tscrim:
Would you agree if I remove
My example above raises a type error while doctesting:
Wasn't that the original intention to write a dedicated |
comment:20
Replying to @mjungmath:
Yes, but that should be done on a separate ticket.
There is a technical reason with incompatible slots in the Cython classes. However, this was not the original intent of this class. The reason is Sage vectors are Cython classes, not Python classes, which only have single inheritance. So they cannot have mixin classes. All of this is done to optimize them because linear algebra needs to be fast. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
comment:36
Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date. |
This comment has been minimized.
This comment has been minimized.
comment:41
By positive review, do you mean all goals of this meta-ticket are complete? We might want to wait for #31706 to be merged before closing here. Once that is done, maybe set the milestone here to sage-duplicate/invalid/wontfix? |
comment:42
Setting a new milestone for this ticket based on a cursory review. |
Tensor fields, scalar fields, sections and (bundle) connections are a priori mutable. However, according to #30181, it should be possible to make them immutable and in conclusion to make them hashable.
Connections and bundle connections are already hashable even though they are not immutable. This will be changed accordingly in this ticket.
Depends on #30181
Depends on #30266
Depends on #30274
Depends on #30280
Depends on #30284
Depends on #30288
Depends on #30310
Depends on #30311
Depends on #31706
CC: @egourgoulhon @mkoeppe @tscrim
Component: manifolds
Keywords: immutability
Issue created by migration from https://trac.sagemath.org/ticket/30261
The text was updated successfully, but these errors were encountered: