Dear Daniel, On Nov 2, 5:12 pm, Daniel Allcock <[EMAIL PROTECTED]> wrote: > Hi all, just got started with SAGE and I hope someone has a suggestion > for me. I have a .sage file defining a big list of approx 170,000 4x4 > matrices with rational number entries, which I will want SAGE to do > various things to. It takes SAGE 4-5 minutes to read in the file > (which was produced by a C++ program), and surely this can be > improved.
Of course, without seeing the code I have no clear idea why this takes so long and blows up the memory. But one remark: There are different ways to create a matrix over QQ, and they do not all take the same time. Examples: sage: timeit('M=Matrix([[1/2,2/3],[3/4,4/5]])') 625 loops, best of 3: 212 µs per loop sage: timeit('M=Matrix(QQ, 2,2);M[0,0]=1/2;M[0,1]=2/3;M[1,0]=3/4;M[1,1]=4/5') 625 loops, best of 3: 111 µs per loop sage: MS=MatrixSpace(QQ,2,2) sage: timeit('M=MS(1/2,2/3,3/4,4/5)') 625 loops, best of 3: 70.4 µs per loop Cheers Simon --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---