-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Add matrix attributes zero and one #16898
Conversation
Matrix codebase currently makes use of the hardcoded constants S.Zero and S.One. That is inconvenient when a non-Basic data type is used to speed up computation (cf. sympy#16883). This PR replaces these constants with class attributes zero and one that can be modified by subclassing.
✅ Hi, I am the SymPy bot (v147). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
Codecov Report
@@ Coverage Diff @@
## master #16898 +/- ##
=============================================
+ Coverage 73.891% 73.904% +0.013%
=============================================
Files 619 619
Lines 160001 160005 +4
Branches 37554 37554
=============================================
+ Hits 118227 118251 +24
+ Misses 36300 36270 -30
- Partials 5474 5484 +10 |
This change seems reasonable. If the zero/one types are tied determined by the Python class of the Matrix does that mean that a new class is needed for each type of matrix entry? Is the plan to create such classes? |
I think that is what is needed. I would expect that only one class will have to be created in most cases.
Yes, I have planned to extend the sympy/sympy/matrices/normalforms.py Lines 46 to 48 in 5158ecf
ring attribute has to be monkey-patched (unless provided as keyword attribute domain ). In the future, a special class should be created.
|
I'll merge in 24 h if there are no objections. |
+1 to merge I don't see why the change here would be controversial. |
Thanks for taking a look. |
References to other Issues or PRs
#16883 and others
Brief description of what is fixed or changed
Matrix codebase currently makes use of the hardcoded constants
S.Zero and S.One. That is inconvenient when a non-Basic data
type is used to speed up computation (cf. #16883). This PR
replaces these constants with class attributes zero and one that
can be modified by subclassing.
Other comments
This is a step of work in progress.
Release Notes