#17663: clean sparse matrices
-------------------------+-------------------------------------------------
Reporter: | Owner:
vdelecroix | Status: needs_review
Type: | Milestone: sage-6.5
enhancement | Resolution:
Priority: major | Merged in:
Component: | Reviewers: Martin von Gagern
linear algebra | Work issues:
Keywords: | Commit:
Authors: | b52ad708d1190c4b5de75bcbafd4f59c13a5c84b
Vincent Delecroix | Stopgaps:
Report Upstream: N/A |
Branch: |
public/17663 |
Dependencies: |
#17658 |
-------------------------+-------------------------------------------------
Comment (by gagern):
Replying to [comment:17 jdemeyer]:
> Did you look too much at #17030 by chance :-)
:-D
That would be a very professional excuse, but I guess I was thinking more
along the lines `bool(…)` vs. `x.__nonzero__()` (which should behave the
same) instead of `bool(x)` vs. `x.is_zero()` as the doctest used them.
Some more comments from reading the latest commit.
* `if entries is None or not entries` could be shortened to `if not
entries`.
* `_cmp_backward` might use `if i != j: return i - j` in the first case as
well. Not sure whether that makes much of a difference.
One more thing, not related to that last commit. Contrary to other sparse
matrix implementations, we don't do a range check for inputs. Of course,
that might be considered a bug in its own right, but if you feel like it,
you could address this here as well.
{{{
sage: m = matrix(Zmod(5)['x'],2,2,{(3,3):2}) # this APPEARS to work at
first
sage: m.is_zero()
False
sage: m
<repr(<sage.matrix.matrix_generic_sparse.Matrix_generic_sparse at
0x7fc795dcbf50>) failed: IndexError: list assignment index out of range>
sage: matrix(Zmod(5),2,2,{(3,3):2}) # this reports the problem early on
...
IndexError: invalid entries list
}}}
--
Ticket URL: <http://trac.sagemath.org/ticket/17663#comment:18>
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.