What is the readable and efficient way to compute the dot product between two columns or rows of a sparse matrix using scipy? Let's say that we want to take the dot product of two vectors x
and y
, two columns of sparse matrix A
, then I'm currently doing:
x = A.getcol(i)
y = A.getcol(j)
dot = (x.transpose() * y)[0,0]
A
is stored in csc
form for efficiency. Is there a more readable way to get the dot product without sacrificing efficiency?
Note: Using Python 2.7.2 with scipy 0.11.0