Hi Thierry,

The sparse matrix actually uses a multimodular algorithm in this case. It's 
written in Cython but essentially runs at Python speed. However, that's not 
where the slowness comes from. Even when running the dense matrix with that 
same algorithm, it's still very fast.

I agree that fundamentally sparse matrices cannot be as fast. But in my 
experience they are often also not very optimized in SageMath. But here it 
seems that something is actually broken because what takes so long is 
computing the transpose of the input matrix. (To reduce a solve_left() to a 
solve_right().)

SageMath seems to have trouble with sparse matrices with many columns 
(actually not that many.) The underlying issue seems to be that this 
already takes 6 seconds on my machine (and this is one order of magnitude 
smaller than the example from Peter.):

A = matrix(QQ, 1, 10000, range(10000), sparse=True)

If somebody wants to dig deeper, I am attaching some profiler output that 
can be opened with https://www.speedscope.app/.

julian

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/b57bbc69-7938-4a84-ac1c-d63ac32f1a6en%40googlegroups.com.

Attachment: sparse.speedscope.json
Description: application/json

Reply via email to