13
I would appreciate any help, to understand following behavior when slicing a lil_matrix (A) from the scipy.sparse package.
Actually, I would like to extract a submatrix based on an arbitrary index list for both rows and columns.
When I used this two lines of code:
x1 = A[list 1,:]
x2 = x1[:,list 2]
Everything was fine and I could extract the right submatrix.
When I tried to do this in one line, it failed (The returning matrix was empty)
x=A[list 1,list 2]
Why is this so? Overall, I have used a similar command in matlab and there it works. So, why not use the first, since it works? It seems to be quite time consuming. Since I have to go through a large amount of entries, I would like to speed it up using a single command. Maybe I use the wrong sparse matrix type...Any idea?