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
Replace =0 by is_zero() in test for matrix being alternating #16306
Comments
comment:3
Hi Darij,
Do we know that Vincent |
comment:4
However, in most examples I've tried,
|
comment:5
Replying to @darijgr:
So, I do not understand the description of the ticket. You wrote
Ok. Looks like a better argument than claiming that there are other rings. Could you provide timings then?
No. I was just asking. Because, if you care about speed, this is by far the fastest. Vincent |
comment:6
I hope you will agree that "all rings" and "all rings in Sage" are two rather different things... :) Some timings on zero elements:
and on nonzero elements:
I don't know how much of the coercion overhead can be removed by improving the coercion system, but for now it looks like |
comment:7
Actually, checking equality with parent.zero() is even faster than checking is_zero(). I'll push this once I am back home. |
comment:10
Fixed. Sorry for it taking such a while! |
comment:11
Replying to @darijgr:
I see, the following tests are more appropriate
|
comment:12
Hi Darij, What is the point of I agree that it is a small ticket. But it is not a reason to not do it cleanly! Thanks, |
Branch pushed to git repo; I updated commit sha1. New commits:
|
This comment has been minimized.
This comment has been minimized.
comment:14
Oops, the use of "not" was a relic of the old version. Part of the reason why comparison with parent().zero() takes so long is that parent() and zero() have to be computed. This can be done once per call of the method, and so the time amortizes quite well. New commits:
|
comment:15
Hi Darij, I still do not understand the motivation for the ticket: the function is not time critical and as you confirmed there is nowhere in Sage a ring whose zero is not 0. The code is better with the branch applied so I set to positive review. Vincent |
comment:16
Thank you! This is a really minor change I wouldn't have done if the code in question wasn't my code from an older ticket. |
comment:17
reviewer name |
Reviewer: Vincent Delecroix |
comment:19
FTR, there is one:
(which we have to do because |
Changed reviewer from Vincent Delecroix to Vincent Delecroix |
Changed branch from public/combinat/matrix0-fix to |
This branch does a couple small improvements to
src/sage/matrix/matrix0.pyx
, the most important one being a replacement of "== 0" by "== zero" since there are rings R whose zero element is not the same as R(0). (Two grammar errors in the doc are also fixed.)CC: @nbruin @stumpc5
Component: linear algebra
Author: Darij Grinberg
Branch/Commit:
f36f0ad
Reviewer: Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/16306
The text was updated successfully, but these errors were encountered: