[SciPy-User] asanyarray behavior with sparse matrices?

Skipper Seabold jsseabold at gmail.com
Fri Feb 12 19:37:54 EST 2010


Bug or wishful thinking on my part?

from scipy import sparse
import numpy as np

X = np.random.rand(50,3)
spX = sparse.csr_matrix(X) # any sparse matrix really
newX = np.asanyarray(spX)

spX is newX
spX.ndim == newX.ndim

Cheers,

Skipper



More information about the SciPy-User mailing list