Out of memory when multiplying matrix and vector

46 views
Skip to first unread message

Ricardo Fodra

unread,
Jun 26, 2025, 9:24:20 PMJun 26
to sage-devel
Why am I running out of memory when I multiply a sparse matrix and a vector:

sage: A
71604 x 143208 sparse matrix over Real Field with 53 bits of precision (use the '.str()' method to see the entries)
sage: A.density()
95465/3418088544
sage: x0
143208 x 1 dense matrix over Real Field with 53 bits of precision (use the '.str()' method to see the entries)
sage: x1 = A * x0
(after a while... out of memory)

David Roe

unread,
Jun 26, 2025, 9:26:05 PMJun 26
to sage-...@googlegroups.com
Try making x0 sparse before multiplying; when you multiply sparse by dense by default Sage turns the spare object into a dense one rather than the dense into sparse.
David

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sage-devel/05a8147d-1b2f-411b-a06e-24dfc9d7ad71n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages