I should say here that the previous row and col methods didn't worked in sparse. They were just returning rows and columns of zeros irrespective of whether they contained any non-zero element.