#16306: Replace =0 by is_zero() in test for matrix being alternating
-------------------------------------+-------------------------------------
Reporter: darij | Owner:
Type: defect | Status: needs_review
Priority: trivial | Milestone: sage-6.2
Component: linear algebra | Resolution:
Keywords: | Merged in:
Authors: Darij Grinberg | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
public/combinat/matrix0-fix | 4d4cbe0664c62dce9780d82e8eb948ee420ce521
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by vdelecroix):
Replying to [comment:4 darij]:
> 1) I don't have good examples. We have semirings where 0 is not the zero
in Sage (try `TropicalSemiring(ZZ)`), but this particular method doesn't
make much sense for these. This is more an issue of principle: We might
eventually get rings like Grothendieck's lambda-rings (the ring of power
series over a given ring K, with multiplication of power series as
addition, and a weirder multiplication -- and, before you ask, there are
finite-dimensional quotients of this, so it's not all lazy power series,
so testing for zeroness does make sense), on which there will suddenly be
a lot of failing code due to the fact that the coerce of 1 (not the coerce
of 0) is the zero element. Better to fix as many of these issues as we can
right now.
So, I do not understand the description of the ticket. You wrote {{{Not
all rings R have their zero element equal to R(0)}}}. But now that I asked
for an example, you say that no such ring exists.
> However, in most examples I've tried, `is_zero` is faster than `== 0`
due to the coercion that has to be resolved for the latter.
Ok. Looks like a better argument than claiming that there are other rings.
Could you provide timings then?
> 2) I don't know. I wouldn't make an assumption on the boolean coerce of
a ring element. But maybe I could...
No. I was just asking. Because, if you care about speed, this is by far
the fastest.
Vincent
--
Ticket URL: <http://trac.sagemath.org/ticket/16306#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.