Adding more than two sparse matrices in one step in Mathematica 9 is very slow (in fact I couldn't even wait for it to finish).
Here's an example. Let's generate a large sparse matrix:
am = AdjacencyMatrix@RandomGraph[{25000, 50000}];
am + am; // Timing (* very fast *)
(am + am) + am; // Timing (* very fast *)
am + am + am; // Timing (* so slow I didn't wait for it to finish *)
Can anyone reproduce this? I used Mathematica 9.0.0 on OS X. Mathematica 8 does not have this problem.
Does anyone have any ideas what may be going wrong here?
RandomGraph[{25000, 50000}]
returns and error. – Mike Honeychurch Jan 20 '13 at 3:32am
! – Mike Honeychurch Jan 20 '13 at 3:44RandomGraph[{50000, 100000}]
but I has to reduce the size to half of that to test on v8 as v8 returned alen32
error for the bigger graph.RandomGraph[{25000, 50000}]
does work fine on 8 here, and the addition does not have the performance problem it has on 9. – Szabolcs Jan 20 '13 at 4:03