Opened 6 years ago
Closed 5 years ago
#17341 closed defect (fixed)
visualize_structure for sparse matrices over GF(p) is broken
Reported by: | jhpalmieri | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | sage-7.1 |
Component: | linear algebra | Keywords: | |
Cc: | Merged in: | ||
Authors: | Jeroen Demeyer | Reviewers: | John Palmieri |
Report Upstream: | N/A | Work issues: | |
Branch: | 2110b6a (Commits, GitHub, GitLab) | Commit: | 2110b6a1ec388a7d0e5c9123a0df20fba2312db4 |
Dependencies: | Stopgaps: |
Description (last modified by )
sage: random_matrix(GF(2), 8, 586, sparse=True).visualize_structure() IndexError: image index out of range
Solution: remove this specialized implementation, since the general one from Matrix
works just fine.
In the generic visualize_structure()
method, we change int
-> Py_ssize_t
to support matrices larger than 2^{31.
}
Change History (9)
comment:1 Changed 5 years ago by
- Description modified (diff)
- Milestone changed from sage-6.4 to sage-7.1
- Summary changed from visualize_structure for matrices: behavior does not match documentation to visualize_structure for sparse matrices over GF(p) is broken
comment:2 Changed 5 years ago by
- Description modified (diff)
comment:3 Changed 5 years ago by
- Branch set to u/jdemeyer/visualize_structure_for_sparse_matrices_over_gf_p__is_broken
comment:4 Changed 5 years ago by
- Commit set to 2110b6a1ec388a7d0e5c9123a0df20fba2312db4
- Status changed from new to needs_review
comment:5 Changed 5 years ago by
I can't even create a matrix with a dimension >= 2^31
:
sage: m = matrix(GF(2), 2**30, 1, {}) Killed: 9
So I can't test the second part of this. The first part looks good.
comment:6 Changed 5 years ago by
The transposed should work if you have sufficient memory:
M = matrix(GF(2), 1, 2^32, sparse=True)
comment:7 Changed 5 years ago by
The changes make sense, but I'm still stuck trying to find an example that used to be broken and now works. I get something like this with or without the change:
sage: M = matrix(GF(2), 1, 2^32, sparse=True) sage: M.visualize_structure(maxsize=None) --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) <ipython-input-3-f258198422bd> in <module>() ----> 1 M.visualize_structure(maxsize=None) /Users/jpalmier/Desktop/Sage_stuff/git/sage/src/sage/matrix/matrix2.pyx in sage.matrix.matrix2.Matrix.visualize_structure (build/cythonized/sage/matrix/matrix2.c:64652)() 8534 fct = 255.0/bisq 8535 from sage.repl.image import Image -> 8536 img = Image('RGB', (ir, ic)) 8537 pixel = img.pixels() 8538 for x in range(ic): /Users/jpalmier/Desktop/Sage_stuff/git/sage/local/lib/python2.7/site-packages/sage/repl/image.pyc in __init__(self, mode, size, color) 95 16x16px 8-bit Color image 96 """ ---> 97 self._pil = PIL.Image.new(mode, size, color) 98 99 @property /Users/jpalmier/Desktop/Sage_stuff/git/sage/local/lib/python2.7/site-packages/PIL/Image.pyc in new(mode, size, color) 2020 color = ImageColor.getcolor(color, mode) 2021 -> 2022 return Image()._new(core.fill(mode, size, color)) 2023 2024 OverflowError: signed integer is greater than maximum
comment:8 Changed 5 years ago by
- Reviewers set to John Palmieri
- Status changed from needs_review to positive_review
As I said before, the second batch of changes make sense, whether they have any immediate benefit or not. So let's merge them.
comment:9 Changed 5 years ago by
- Branch changed from u/jdemeyer/visualize_structure_for_sparse_matrices_over_gf_p__is_broken to 2110b6a1ec388a7d0e5c9123a0df20fba2312db4
- Resolution set to fixed
- Status changed from positive_review to closed
visualize_structure
no longer has afilename
argument.