David Kohel
unread,Jun 26, 2012, 4:32:26 AM6/26/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sage-...@googlegroups.com
1. For free abelian groups, the iterator doesn't enumerate any elements.
sage: A = AbelianGroup(3)
sage: A
Multiplicative Abelian Group isomorphic to Z x Z x Z
sage: for a in A:
....: print a
....:
The bug is in A.__iter__:
invs = self.invariants()
for t in mrange(invs):
yield AbelianGroupElement(self, t)
since invs is [0,0,0] the mrange is empty.
2. For free ZZ-modules the iterator doesn't enumerate all elements.
sage: M = ZZ^3
sage: for v in M:
print v
if sum([ abs(v[i]) for i in range(3) ]) > 8:
break
....:
(0, 0, 0)
(1, 0, 0)
(-1, 0, 0)
(2, 0, 0)
(-2, 0, 0)
(3, 0, 0)
(-3, 0, 0)
(4, 0, 0)
(-4, 0, 0)
(5, 0, 0)
(-5, 0, 0)
(6, 0, 0)
(-6, 0, 0)
(7, 0, 0)
(-7, 0, 0)
(8, 0, 0)
(-8, 0, 0)
(9, 0, 0)