[Numpy-discussion] numarray bug: dot product between 2x2 and 3x2x3 on Mac different from PC

Travis Oliphant oliphant.travis at ieee.org
Mon Jul 17 15:10:42 EDT 2006


Sebastian Haase wrote:
> 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 !
>   

I don't see why this is a bug.  You are trying to coerce a 32-bit 
integer to a 32-bit float.  That is going to lose precision and so you 
get the error indicated.

-Travis





More information about the NumPy-Discussion mailing list