Sparse dot product python
I'm trying to implement a sparse vector (most elements are zero) dot product calculation. My major idea is to represent each sparse vector as a list (which holds only non-zero dimensions), and each element in the list is a 2-dimensional tuple -- where first dimension is . I'm trying to take the dot product of a row in a sparse matrix with the transpose of that row using Python. I have a huge sparse matrix called X2. And I am saving the results (which is supposed to be a single number) in a list called Njc. X2 = area907.infoose() for row in X2: area907.info(dot(row,area907.infoose())). area907.info_matrix Sparse matrices can be used in arithmetic operations: they support addition, subtraction, multiplication, division, and matrix power. dot (other) Ordinary dot product: eliminate_zeros Remove zero entries from the matrix: expm1 Element-wise expm1.