[SciPy-user] Getting the right numerical libraries for scipy
William K. Coulter
wcoulter@berkeley....
Fri Apr 3 10:32:43 CDT 2009
Thanks all for your replies.
While this benchmark is interesting, it is not the one that I was
trying. I'm interested in computations where just *one* of the matrices
is actually sparse. I'm looking at something more like the following in
your script's language -- I'm guessing on the syntax for Timer:
c = np.random.random((s,s)) # c is dense
b = np.random.random((s, s))
b[b > d] = 0 # b sparse, but dense representation
b_s = ss.csc_matrix(b) # b_s sparse, with sparse rep.
timer_dense = Timer("np.dot(b,c)", "import __main__ as m") # test1
timer_sparse = Timer("b_s.matmat(c)", "import __main__ as m") # test2
Could you look at those curves? Would you not expect the multiplication
using the sparse version of b (b_s) to be faster?
On matlab, the equivalent to test2 runs far faster (20x) than test1,
whereas in python, I'm seeing completely the opposite. Since there are
questions about the dense/sparse ratio, I get speedup in matlab on using
sparse representation for one matrix for ratios (d) of 0.5 and lower.
Any ideas for the performance difference?
-- Will
From Stéfan van der Walt on 4/3/2009 6.55:
> 2009/4/3 David Cournapeau <david@ar.media.kyoto-u.ac.jp>:
>> Maybe a more useful benchmark would be the dense/sparse ratio as a
>> function of density for a given size,
>
> http://mentat.za.net/refer/bench_ratio.png
>
> Cheers
> Stéfan
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
--
William K. Coulter wcoulter@berkeley.edu
Graduate Student, Helen Wills Neuroscience Institute, UC Berkeley
More information about the SciPy-user
mailing list