[SciPy-user] math operations on sparse matrices

Stéfan van der Walt stefan@sun.ac...
Sat Feb 21 17:43:41 CST 2009


2009/2/21  <josef.pktd@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