Re: [Numpy-discussion] checking element types in array

2008-05-18 Thread Zoho Vignochi
On Sat, 17 May 2008 14:58:20 -0400, Anne Archibald wrote: > numpy arrays are efficient, among other reasons, because they have > homogeneous types. So all the elements in an array are the same type. > (Yes, this means if you have an array of numbers only one of which > happens to be complex, you h

Re: [Numpy-discussion] checking element types in array

2008-05-17 Thread Anne Archibald
2008/5/17 Zoho Vignochi <[EMAIL PROTECTED]>: > hello: > > I am writing my own version of a dot product. Simple enough this way: > > def dot_r(a, b): >return sum( x*y for (x,y) in izip(a, b) ) > > However if both a and b are complex we need: > > def dot_c(a, b): >return sum( x*y for

[Numpy-discussion] checking element types in array

2008-05-17 Thread Zoho Vignochi
hello: I am writing my own version of a dot product. Simple enough this way: def dot_r(a, b): return sum( x*y for (x,y) in izip(a, b) ) However if both a and b are complex we need: def dot_c(a, b): return sum( x*y for (x,y) in izip(a.conjugate(), b) ).real I would like to combi