I'm having a difficult time understanding the following behavior:

import numpy as N
# create a new array 4 rows, 3 columns
x = N.random.random((4, 3))
# elementwise multiplication
x*x

newtype = N.dtype([('x', N.float64), ('y', N.float64), ('z', N.float64)])

# interpret the array as an array of cartesian coordinates
x.dtype = newtype

x*x

--> TypeError: unsupported operand type(s) for *: 'numpy.ndarray' and '
numpy.ndarray'

N.__version__
'1.0.2.dev3498'

So just by assigning names to the columns, I can't multiply the arrays any
more?
Numpy itself still claims that x is an ndarray.
I hope this is a bug, because it would be really convenient if this still
worked after assigning names to columns.
What I really wanted to do was N.dot(x, x.T) to get the length of the
cartesian vectors, but (I think) this fails for the same reason.

Please tell me this is a bug ;-)

Cheers,
   Jan
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to