Opened 15 years ago
Closed 15 years ago
#3023 closed defect (fixed)
[with patch, positive review] make apply_map deal with empty matrices
Reported by: | jason | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-3.0.1 |
Component: | linear algebra | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
sage: m=matrix([]) sage: m.apply_map? sage: m.apply_map(lambda x: x) --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/grout/sage/devel/sage-main/sage/matrix/<ipython console> in <module>() /home/grout/sage/devel/sage-main/sage/matrix/matrix_dense.pyx in sage.matrix.matrix_dense.Matrix_dense.apply_map (sage/matrix/matrix_dense.c:3098)() 307 v = sage.structure.sequence.Sequence(v) 308 R = v.universe() --> 309 M = sage.matrix.matrix_space.MatrixSpace(R, self._nrows, 310 self._ncols, sparse=False) 311 image = M(v) /home/grout/sage/local/lib/python2.5/site-packages/sage/matrix/matrix_space.py in MatrixSpace(base_ring, nrows, ncols, sparse) 171 """ 172 if not sage.rings.ring.is_Ring(base_ring): --> 173 raise TypeError, "base_ring (=%s) must be a ring"%base_ring 174 175 if ncols is None: ncols = nrows <type 'exceptions.TypeError'>: base_ring (=Category of objects) must be a ring
m.apply_map(blah) should return an empty matrix in this case.
Attachments (1)
Change History (5)
Changed 15 years ago by
Attachment: | trac-3023-matrix-applymap-empty.patch added |
---|
comment:1 Changed 15 years ago by
comment:2 Changed 15 years ago by
Summary: | make apply_map deal with empty matrices → [with patch, needs review] make apply_map deal with empty matrices |
---|
comment:3 Changed 15 years ago by
Summary: | [with patch, needs review] make apply_map deal with empty matrices → [with patch, positive review] make apply_map deal with empty matrices |
---|
[19:04] <mabshoff> so, what is the verdict on #3023? [19:04] <jason> positive review from me :) I don't think that counts, though [19:05] <mabshoff> Well, as author it is expected that you think your patch it a good idea. [19:05] <mabshoff> It seems like the sensible thing to do. [19:07] <dfdeshom> running testall now, but positive review from me [19:08] <dfdeshom> (and i'll put it in writing when the tests finish)
comment:4 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Merged in Sage 3.0.1.alpha0
Note: See
TracTickets for help on using
tickets.
doctests in the matrix/ directory pass with the above patch.