Hi,

I naively expected making the zero nxn sparse matrix in Sage to be
O(1), and so might you.  However:

sage: get_memory_usage()
836.4921875
sage: time a = matrix(QQ, 2^25, sparse=True)
Time: CPU 6.79 s, Wall: 6.79 s
sage: get_memory_usage()
3908.30078125
sage: time b = matrix(QQ, 2^26, sparse=True)
Time: CPU 12.20 s, Wall: 12.20 s
sage: get_memory_usage()
10052.4375

If this bugs you, maybe look at http://trac.sagemath.org/sage_trac/ticket/12348

I wouldn't be surprised to find that this is totally my fault for
doing something really stupid long ago, like caching matrix space
spaces or something.  Maybe not, since:

sage: time v = b.parent().basis()
Traceback (most recent call last):

/home/wstein/<ipython console> in <module>()

/usr/local/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
in basis(self)
    939             ]
    940         """
--> 941         v = [self.zero_matrix().__copy__() for _ in
range(self.dimension())]
    942         one = self.base_ring()(1)
    943         i = 0

OverflowError: range() result has too many items


-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

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