Opened 12 years ago
Closed 11 years ago
#10470 closed defect (fixed)
Listing an infinite vector space just hangs
Reported by: | rbeezer | Owned by: | jason, was |
---|---|---|---|
Priority: | minor | Milestone: | sage-4.7 |
Component: | linear algebra | Keywords: | |
Cc: | Merged in: | sage-4.7.alpha4 | |
Authors: | Rob Beezer | Reviewers: | John Palmieri |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
Asking for a list of elements in an infinite vector space does not raise an error, but requires a Ctrl-C to get back the command-line.
sage: V=QQ^2 sage: V Vector space of dimension 2 over Rational Field sage: V.list() <hang>
Of course, finite examples work properly:
sage: V=GF(3)^2 sage: V.list() [(0, 0), (1, 0), (2, 0), (0, 1), (1, 1), (2, 1), (0, 2), (1, 2), (2, 2)]
Maybe this should be addressed in the module code, I have not looked into the cause much. Perhaps a fix could be as simple as having a non-zero dimension with an infinite base ring throwing an error?
Apply both patches, trac_10470-listing-infinite-sets.patch and trac_10470-referee-doc.patch.
Attachments (2)
Change History (10)
comment:1 Changed 12 years ago by
Changed 11 years ago by
comment:2 Changed 11 years ago by
- Status changed from new to needs_review
comment:3 Changed 11 years ago by
comment:4 Changed 11 years ago by
This was discussed further on sage-devel:
http://groups.google.com/group/sage-devel/browse_thread/thread/3bb0f163b1fb1020
Patch just checks to see if a parent knows that is infinite, and if so, bails out with an explanation. Otherwise behavior should be the same. Passes the full test suite.
comment:5 Changed 11 years ago by
- Description modified (diff)
- Reviewers set to John Palmieri
I'm happy with the main patch: it gets a positive review. I've added a little documentation about using X.list()
vs. list(X)
. If it's not appropriate, let me know and we can just go with the main patch.
comment:6 Changed 11 years ago by
Additional documentation looks good.
comment:7 Changed 11 years ago by
- Status changed from needs_review to positive_review
comment:8 Changed 11 years ago by
- Merged in set to sage-4.7.alpha4
- Resolution set to fixed
- Status changed from positive_review to closed
It seems
ZZ
andQQ
and (maybe others) have never-ending iterators. So an attempt to iterate over modules likeZZ^2
orQQ^2
just keep making linear combinations like crazy, but never coming to any finite conclusion. Testing a fix now.