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

On Thu, Jun 26, 2025 at 9:24 PM Ricardo Fodra <ricardo.fo...@gmail.com>
wrote:

> 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)
>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion visit
> https://groups.google.com/d/msgid/sage-devel/05a8147d-1b2f-411b-a06e-24dfc9d7ad71n%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/05a8147d-1b2f-411b-a06e-24dfc9d7ad71n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/CAChs6_nqzkrF6y0zK5rLRdXuh%3Db5T%3DNih-UzsA0nujpN3205bA%40mail.gmail.com.

Reply via email to