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)




-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to