[SciPy-user] Sparse int and float performance

Dinesh B Vadhia dineshbvadhia@hotmail....
Thu Nov 20 13:19:48 CST 2008

A question for Nathan Bell:

I use Scipy Sparse to solve y = Ax, where A is a MxN "binary" sparse matrix and x is a dense floating point vector, with M and N each >100,000

I use the following to create the CSR matrix:

row = numpy.empty(nnz, dtype='intc')
column = numpy.empty(nnz, dtype='intc')
<read i,j into row and column>
data = numpy.ones(nnz, dtype='intc')
A = sparse.csr_matrix((data, (row, column)), shape=(I,J))

Now, suppose that we change data to the float datatype ie.

data = numpy.ones(nnz, dtype=float)

I know I can test this but from the perspective of the scipy code, how would this impact the performance of the calculation of y = Ax ie.

- Same as data with dtype='intc'
- Slower than data with dtype = 'intc'
- Faster than data with dtype = 'intc'



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20081120/ad701109/attachment.html 

More information about the SciPy-user mailing list