Hi there!

I've got a really simple task of finding the rank of a matrix of *integers*. 
NumPy's matrix_rank() appeared to use floats internally (and gave a clearly 
wrong answers when the matrix contained both small and huge coefficients 
like 1 and 10**16), so I decided to try SymPy instead. Unfortunately, I 
found it pretty much impossible to find the rank of a dense matrix of size 
30×30 (and above), since it took forever. I timed it and found out that 
runtime grows *exponentially* (which is really mysterious for me).

Am I doing something wrong? Is there a better way?

Here's a trivial example of what I do.

PS C:\> python -m timeit -s "import sympy" "sympy.*randMatrix(10).rank()*"
20 loops, best of 5: *13 msec* per loop
PS C:\> python -m timeit -s "import sympy" "sympy.*randMatrix(15).rank()*"
5 loops, best of 5: *47.7 msec* per loop
PS C:\> python -m timeit -s "import sympy" "sympy.*randMatrix(20).rank()*"
1 loop, best of 5: *2.26 sec* per loop

And here's the plot for matrix sizes up to 20 (horizontal axis) with time 
in seconds.

[image: ranktime.png]

Thanks for any help or explanation!

Cheers!
Oleg

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/8922d16f-6771-434e-8cb0-dc1825c6f2a9n%40googlegroups.com.

Reply via email to