I have just rewritten and add a few functions for row operations in my current PR. The diff looks quite messy just have a look at [1]. This is rewritten although it is largely the same.
Here is the summary of profile results. I am now using gmpy ground types. >>> for i in range(1000, 3000): ... n.append(i) ... >>> for i in range(1000, 3000): ... m.append(n) ... >>> a = Matrix(m) >>> cProfile.run("a + a") 40012072 function calls in 23.230 seconds ncalls tottime percall cumtime percall filename:lineno(function) 4000000 1.624 0.000 2.809 0.000 matrices.py:152(<lambda>) 4000000 2.575 0.000 13.641 0.000 matrices.py:519(<lambda>) 4000000 3.077 0.000 4.052 0.000 numbers.py:1522(__new__) 4000000 4.845 0.000 11.066 0.000 numbers.py:1588(__add__) 8000000 2.486 0.000 2.486 0.000 sympify.py:50(sympify) 12002006 3.145 0.000 3.145 0.000 {isinstance} 4002000 0.297 0.000 0.297 0.000 {method 'append' of 'list' objects} >>> cProfile.run("add(m, m, ZZ)") 28008005 function calls in 12.874 seconds ncalls tottime percall cumtime percall filename:lineno(function) 2000 5.772 0.003 12.492 0.006 densetools.py:11(addrow) 8000000 2.280 0.000 3.151 0.000 domain.py:64(new) 8000000 3.230 0.000 6.381 0.000 domain.py:67(__call__) 8000000 0.871 0.000 0.871 0.000 {gmpy.mpz} Of course the part that is pulling current matrices backwards are the sympify calls and calls from numbers.py. I am not sure if sympify will be added in the WIP matrix design. Also interesting are the lambda calls of Matrix class. I have not found any difference if I make the list of lists as this. They take exactly the same number of function calls. Maybe I am doing something wrong here. m, n = [], [] >>> for i in range(1000, 3000): ... n.append(ZZ(i)) ... >>> for m in range(1000, 3000): ... m.append(n) Also, can anyone please see if the current thing is in right direction as level 0 of dense? I am now working assuming that dense matrices will be represented internally just as lists of lists. I would especially appreciate feedback from Mateusez since the design is similar to Polys' design he implemented[2] Also, can anyone please suggest me some references for algorithms of rref? I know it's currently in sympy but I want to explore if I can make the current thing faster. -Saurabh [1] https://github.com/SaurabhJha/sympy/blob/d62233663e5d234090124aacce71fe37106e5a32/sympy/matrices/densetools.py [2] http://mattpap.github.io/masters-thesis/html/index.html -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.