[SciPy-user] math operations on sparse matrices

Stéfan van der Walt stefan at sun.ac.za
Sat Feb 21 18:43:41 EST 2009


2009/2/21  <josef.pktd at gmail.com>:
> I have a (dok) sparse distance matrix and I would like to take the
> exponential of the distances

I guess you could just as well switch to dense matrices then, since
exp(0) is no longer zero.

If you just want to change the non-zero values, you can use

x.data = np.exp(x.data)

Regards
Stéfan



More information about the SciPy-User mailing list