Thanks Chris,
If this got fixed towards numarray version 1.5.1 it looks like
it is now on both Linux and Mac
different(!) from the numpy result I got on Window !!
On Linux I get:
>>> import numpy as N
>>> N.__version__
'0.9.9.2823'
>>> bbb=N.zeros((2,3,3), N.float32)
>>> bbb[0,:,:]=1
>>> bbb[1,:,:]=2
>>> bbb
[[[ 1.  1.  1.]
  [ 1.  1.  1.]
  [ 1.  1.  1.]]

 [[ 2.  2.  2.]
  [ 2.  2.  2.]
  [ 2.  2.  2.]]]
>>> ccc=N.transpose(bbb,(1,0,2))
>>> d=N.array([[1,0],[0,1]])
>>> d
[[1 0]
 [0 1]]
>>> N.dot(d,ccc)
Traceback (most recent call last):
  File "<input>", line 1, in ?
TypeError: array cannot be safely cast to required type
>>> dd=d.astype(N.float32)
>>> N.dot(dd,ccc)
[[[ 1.  1.  1.]
  [ 1.  1.  1.]
  [ 1.  1.  1.]]

 [[ 2.  2.  2.]
  [ 2.  2.  2.]
  [ 2.  2.  2.]]]
>>> 


The TypeError looks like a numpy bug !

Thanks,
Sebastian Haase




On Monday 17 July 2006 11:29, Christopher Barker wrote:
> And on my Mac:
>
> OS-X 10.4.*, PPC, universal python 2.4.3:
>  >>> import numarray as na
>  >>> na.__version__
>
> '1.5.1'
>
>  >>> bbb=na.zeros((2,3,3), na.Float32)
>  >>> bbb[0,:,:]=1
>  >>> bbb[1,:,:]=2
>  >>> ccc=na.transpose(bbb,(1,0,2))
>  >>> d=na.array([[1,0],[0,1]])
>  >>> na.dot(d,ccc)
>
> array([[[ 1.,  1.,  1.],
>          [ 2.,  2.,  2.],
>          [ 1.,  1.,  1.]],
>
>         [[ 2.,  2.,  2.],
>          [ 1.,  1.,  1.],
>          [ 2.,  2.,  2.]]], type=Float32)

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to