On Jul 16, 3:37 am, Rado <rki...@gmail.com> wrote:
> A = random_matrix(GF(5), 5, 10)
> #------
> timeit('all2 = A.row_space().list()')

This looks basically like:

sage: A = random_matrix(GF(5), 5, 10)
sage: V = A.row_space()
sage: it = V.__iter__()
sage: time x = list(it)
Time: CPU 0.58 s, Wall: 0.59 s
sage: timeit("x = list(it)")
625 loops, best of 3: 2.19 µs per loop

Note the results are cached, so watch out using timeit.  (There is a
general method, _list_from_iterator_cached() in sage/structure/
parent.pyx.)

Perhaps your recursive approach could speed up

sage.modules.free_module.FreeModule_generic.__iter__

but maybe only in the case of a finite base ring?  The current
iterator is allowed to run infinitely long over an infinite base ring,
in the event that it is used to obtain some finite collection of
elements.  But it looks like the current iterator never escapes the
first coordinate (say with QQ^2), which might be the same with your
proposed iterator.

And where to put it may now be a moot question.  ;-)

Rob

-- 
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