[SciPy-user] Trace of a sparse matrix ?

Nils Wagner nwagner at mecha.uni-stuttgart.de
Thu Feb 16 10:43:08 CST 2006


Arnd Baecker wrote:
>On Thu, 16 Feb 2006, Nils Wagner wrote:
>
>  
>>Hi all,
>>
>>Is it possible to compute the trace of a sparse matrix say A
>>without detouring
>>
>>spur=trace(A.todense()) ?
>>    
>
>what about summing up all diagonal elements which exist in A?
>  
and are not equal to zero.

It would be nice to have a built-in function "sptrace(A)" for this task
within scipy :-)

The same holds for the norm of a sparse matrix

spnorm(A)

linalg.norm(A.todense()) is not optimal or even impossible if A is
really large.

Nils

>Arnd
>
>_______________________________________________
>SciPy-user mailing list
>SciPy-user at scipy.net
>http://www.scipy.net/mailman/listinfo/scipy-user
>  


 




More information about the SciPy-user mailing list