I have two huge sparse matrices, and I am interested in dot multiplication them. But I have a memory issue so a notebook is a shutdown. I am using the 11.3 version. Any suggestion on how to avoid memory issues.
Edit:
n = 30000;
m = 22000000;
mat = SparseArray[
RandomInteger[{1, n}, {m, 2}] -> RandomReal[{0, 1}, m], {n, n}];
mat2 = SparseArray[
mat["NonzeroPositions"] ->
RandomReal[{0, 1}, Length@mat["NonzeroPositions"]],
Dimensions[mat]];
u
being a vector, instead ofres.u
, you should usemat.(mat.u)
. This might bring also a considerable speed-improvement, if only few of results of the formres.u
are needed. I gets more complicated whenres
has to enter a linear system which you want to solve. But if you cannot buildres
, then you cannot solve the system with direct methods anyways. So you would have to switch to (preconditoned!) iterative methods. $\endgroup$ – Henrik Schumacher Sep 3 '18 at 21:04mat.(mat.u)
. $\endgroup$ – Henrik Schumacher Sep 3 '18 at 21:05