[SciPy-user] funm AttributeError: typecode

Fernando Perez fperez at pizero.colorado.edu
Thu Mar 14 11:48:15 EST 2002


On Thu, 14 Mar 2002, Nils Wagner wrote:

> Again, I can give no account of it.
> 
>     funm([[1.,0.],[0.,1.]], exp)
>   File
> "/usr/local/lib/python2.1/site-packages/scipy/linalg/linear_algebra.py",
> line 836, in funm
>     tol = {0:feps, 1:eps}[_array_precision[A.typecode()]]
> AttributeError: typecode

There's a difference between python lists and Numeric arrays:

In [1]: import Numeric
 
In [2]: A_list = [[1.,0.],[0.,1.]]
 
In [3]: A_array = Numeric.array(A_list)
 
In [4]: A_list 
Out[4]: [[1.0, 0.0], [0.0, 1.0]]
 
In [5]: A_array 
Out[5]: array([[ 1., 0.],
       [ 0., 1.]])
 
In [6]: A_list.typecode()
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
 
?
 
AttributeError: 'list' object has no attribute 'typecode'
 
In [7]: A_array.typecode 
------> A_array.typecode ()
Out[7]: 'd'   

Cheers,

f.




More information about the SciPy-User mailing list