I have two big sparse double matrices in Matlab:
Pwith dimension1048576 x 524288Iwith dimension1048576 x 524288
I want to find the number of entrances i,j such that P(i,j)<=I(i,j)
Naively I tried to run
n=sum(sum(P<=I));
but it is extremely slow (I had to shut down Matlab because it was running since forever and I wasn't able to stop it).
Is there any other more efficient way to proceed or what I want to do is unfeasible?
P<=I. If its true all the time, then the answer is a "full" sparse matrix, taking about 2.5~3x more memory that if it was a normal full matrix. If this is expected, perhaps looping, even if its row-wise, is a better idea, as likely what it is making this operation slow is the need of memory, not the arithmetics - Ander Biguri