[SciPy-user] Sparse matrices .todense(Complex)

Travis Oliphant oliphant at ee.byu.edu
Thu Nov 18 12:32:08 EST 2004


Nils Wagner wrote:

> Hi all,
>
> Thanks a lot for the latest fixes with respect to handling of complex 
> matrices by iterative solvers.
> One thing, which doesn't work is the change from sparse to dense 
> matrices in case of complex matrices.
>
> >>> print A
>  (0, 0)        0.809662640095
>  (0, 1)        (0.880416512489+0.50495326519j)
>  (1, 0)        (0.880416512489-0.50495326519j)
>  (1, 1)        0.733849585056
>  (1, 2)        (0.907823622227+0.290321737528j)
>  (2, 1)        (0.907823622227-0.290321737528j)
>  (2, 2)        0.300018787384
> >>> A.todense(Complex)
> array([[ 0.80966264,  0.88041651,  0.        ],
>       [ 0.88041651,  0.73384959,  0.90782362],
>       [ 0.        ,  0.90782362,  0.30001879]])
> >>>

This is now fixed in CVS (or will be in a few minutes).  But, note that 
it only corresponds to dok_matrices.  The other kinds of matrices have 
not had the same problems which stem from not being able to tell what 
the type of a dok_matrix is until you actually convert it to a dense 
matrix...

-Travis




More information about the SciPy-User mailing list