Opened 11 years ago

Closed 10 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:

Status badges

Description (last modified by jhpalmieri)

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)

trac_10470-listing-infinite-sets.patch (3.0 KB) - added by rbeezer 10 years ago.
trac_10470-referee-doc.patch (924 bytes) - added by jhpalmieri 10 years ago.
apply on top of other patch

Download all attachments as: .zip

Change History (10)

comment:1 Changed 11 years ago by rbeezer

It seems ZZ and QQ and (maybe others) have never-ending iterators. So an attempt to iterate over modules like ZZ^2 or QQ^2 just keep making linear combinations like crazy, but never coming to any finite conclusion. Testing a fix now.

Changed 10 years ago by rbeezer

comment:2 Changed 10 years ago by robertwb

  • Status changed from new to needs_review

comment:3 Changed 10 years ago by rbeezer

  • Authors set to Rob Beezer

comment:4 Changed 10 years ago by rbeezer

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.

Changed 10 years ago by jhpalmieri

apply on top of other patch

comment:5 Changed 10 years ago by jhpalmieri

  • 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 10 years ago by rbeezer

Additional documentation looks good.

comment:7 Changed 10 years ago by jhpalmieri

  • Status changed from needs_review to positive_review

comment:8 Changed 10 years ago by jdemeyer

  • Merged in set to sage-4.7.alpha4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.