[SciPy-user] asanyarray

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Feb 2 01:45:02 CST 2007


Hi,

I am confused about the behaviour of asanyarray

Python 2.4.1 (#1, Oct 13 2006, 16:51:58)
[GCC 4.0.2 20050901 (prerelease) (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import *
>>> A = io.mmread('mhd416a.mtx.gz')
>>> A
<416x416 sparse matrix of type '<type 'numpy.float64'>'
        with 8562 stored elements in COOrdinate format>
>>> shape(A)
(416, 416)
>>> A=asanyarray(A)
>>> A
array(<416x416 sparse matrix of type '<type 'numpy.float64'>'
        with 8562 stored elements in COOrdinate format>, dtype=object)
>>> shape(A)
()
 
Help on function asanyarray in module numpy.core.numeric:

asanyarray(a, dtype=None, order=None)
    Returns a as an array, but will pass subclasses through.

Why is the shape altered by asanyarray ?

Nils




More information about the SciPy-user mailing list