- The size of a 10^5x10^5 double matrix would be 74.5GB. Do you have enough memory to support this?
- I am doubting that the code does what you are thinking it does, but I can't tell either because I don't know what A represents. It does exactly what I describe above.
- Does meanNV need to be a 113336x113336 matrix? You mention A has similar dimensions to this, but you are only storing m elements in meanNV (one for each row of A), so I think you mean to make this:
- You can avoid for loops to improve speed. Use logical criteria. The variable below contains a one in every location where A(i,j) == 1 with no need for a loop.
- Now we can loop through the rows and find the last element with a 1: