[SciPy-user] Sparse int and float performance

Nathan Bell wnbell@gmail....
Fri Nov 21 09:42:43 CST 2008

On Fri, Nov 21, 2008 at 8:53 AM, Dinesh B Vadhia
<dineshbvadhia@hotmail.com> wrote:
> Like I said, I haven't looked at the sparse solver code to know how it works
> but if x is a dense float vector, A a binary matrix with
> data = numpy.ones(nnz, dtype='intc')
> Then, if there were a mixed matrix-vector multiplication version of the
> sparse solver that didn't upcast it to float would there be a performance
> improvement in the calculation of y = Ax?

It depends which sparse solver we're talking about.  In principle, the
iterative solvers could perform operations like y=A*x where x and y
are floats and A is an int.  The direct solvers (i.e. SuperLU, a
sparse LU method) would always need floats.

Is there any reason not to use dtype='float32'?  It should require no
upcast in the sparse solvers.

Nathan Bell wnbell@gmail.com

More information about the SciPy-user mailing list