[SciPy-user] Getting the right numerical libraries for scipy
William K. Coulter
wcoulter@berkeley....
Thu Apr 2 15:35:42 CDT 2009
I wanted to optimize my python code to use the scipy.sparse library;
however, benchmarking reveals that multiplying a sparse and dense matrix
takes over 100 times as long as multiplying the equivalent two dense
matrices.
This suggests that I have at least one of the numerical libraries linked
with python, but that the sparse ones aren't.
I understand that numpy/distutils/system_info.py should contain some
helpful information, but I can't read the output and don't know how to
ensure that the libraries are there in a clean install.
How could I check for the libraries and what would I do to install them
if they are not there? I'm on a redhat system.
Thanks much,
-- Will
PS: Here's an example of what I'm comparing (b is the dense
representation of a sparse matrix; c is dense). counter2 > 100*counter1
for many iterations:
bsp = sparse.csc_matrix(b)
t1 = time.time()
for i in range(n):
np.dot(b,c)
t2 = time.time()
counter1 += t2-t1
t1 = time.time()
for i in range(n):
bsp.matmat(c)
t2 = time.time()
counter2 += t2-t1
--
William K. Coulter
Graduate Student, Helen Wills Neuroscience Institute, UC Berkeley
More information about the SciPy-user
mailing list