# [SciPy-User] element-wise exponentiation

Marcel Blattner blattnem@gmail....
Thu Sep 9 06:48:55 CDT 2010

```Thankx......everything smooth now....

On Thu, Sep 9, 2010 at 1:28 PM, Christopher Mutel <cmutel@gmail.com> wrote:

> It is usually easier to mathematical operations on a compressed
> matrix, e.g. CSR or CSC. Access the arrays that hold actual data is
> much easier (in my opinion).
>
> One simple option would be:
> A = A.tocsr()
> A.data = A.data**0.2 # This is the array that hold the actual values
> in the sparse matrix
> A = A.tolil() # If desired
>
> -Chris
>
> On 9 September 2010 13:14, Marcel Blattner <blattnem@gmail.com> wrote:
> > Hi
> > I have a beginners question. I have to exponentiate each element of a
> sparse
> > lil-matrix.
> > I did:
> > a,b = A.nonzero()
> > for i in range(a.size):
> >       A[a[i],b[i]] = A[a[i],b[i]]**0.2
> > Is there a way to do something like A**0.2 like in numpy?
> > Cheers
> >
> > _______________________________________________
> > SciPy-User mailing list
> > SciPy-User@scipy.org
> > http://mail.scipy.org/mailman/listinfo/scipy-user
> >
> >
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100909/b20bf1f3/attachment.html
```