Re: [Numpy-discussion] matrix multiplication (newbie question)

2006-11-09 Thread Johannes Loehnert
> Well what about A*(B*C)? Point taken... Johannes - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSp

[Numpy-discussion] Grief with a complex value

2006-11-09 Thread Colin J. Williams
>>> import numpy.core as _n >>> _nt= _n.numerictypes >>> value= '[EMAIL PROTECTED]@[EMAIL PROTECTED]@\x00\x00\x00\x00\x00\x00\x18@' >>> _n.array(value, dtype= _nt.complex128, copy=True) Traceback (most recent call last): File "", line 1, in TypeError: a float is required >>> A bug? Coli

Re: [Numpy-discussion] Grief with a complex value

2006-11-09 Thread Robert Kern
Colin J. Williams wrote: > >>> import numpy.core as _n > >>> _nt= _n.numerictypes > >>> value= > '[EMAIL PROTECTED]@[EMAIL PROTECTED]@\x00\x00\x00\x00\x00\x00\x18@' > >>> _n.array(value, dtype= _nt.complex128, copy=True) > Traceback (most recent call last): > File "", line 1, in > TypeError

[Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Fernando Perez
I understand why this happens, but I wonder if it should be in any way 'fixed' (if that is even feasible without introducing other problems): In [28]: x = 99 In [29]: y = numpy.array([x]) In [30]: z = y[0] In [31]: x==z Out[31]: True In [32]: x Out[32]: 99 In [33]: z Out[33]: 99

Re: [Numpy-discussion] Grief with a complex value

2006-11-09 Thread Colin J. Williams
Robert Kern wrote: > Colin J. Williams wrote: > >> >>> import numpy.core as _n >> >>> _nt= _n.numerictypes >> >>> value= >> '[EMAIL PROTECTED]@[EMAIL PROTECTED]@\x00\x00\x00\x00\x00\x00\x18@' >> >>> _n.array(value, dtype= _nt.complex128, copy=True) >> Traceback (most recent call last): >>

Re: [Numpy-discussion] Grief with a complex value

2006-11-09 Thread Stefan van der Walt
On Thu, Nov 09, 2006 at 03:18:57AM -0500, Colin J. Williams wrote: > > >>> import numpy.core as _n > >>> _nt= _n.numerictypes > >>> value= > '[EMAIL PROTECTED]@[EMAIL PROTECTED]@\x00\x00\x00\x00\x00\x00\x18@' > >>> _n.array(value, dtype= _nt.complex128, copy=True) > Traceback (most recent cal

Re: [Numpy-discussion] slice assignment: strange behaviour

2006-11-09 Thread Alan G Isaac
On Wed, 08 Nov 2006, koara apparently wrote: > 'mat' is a numpy.array with shape=(22973, 1009), > 'vec' is a numpy.array with shape=(22973,), both of type int: > for i in xrange(1009): > ... > fr = vec[10001] > mat[:, i] = vec # assign whole column > if mat[10001, i] != fr:

Re: [Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Robert Kern
Fernando Perez wrote: > I understand why this happens, but I wonder if it should be in any way > 'fixed' (if that is even feasible without introducing other problems): > > In [28]: x = 99 > > In [29]: y = numpy.array([x]) > > In [30]: z = y[0] > > In [31]: x==z > Out[31]: True > > In [32]:

Re: [Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Fernando Perez
On 11/9/06, Robert Kern <[EMAIL PROTECTED]> wrote: > Fernando Perez wrote: > > I understand why this happens, but I wonder if it should be in any way > > 'fixed' (if that is even feasible without introducing other problems): [...] > > I am sure it will be, to say the least, pretty surprising (and

Re: [Numpy-discussion] Anyone have a "little" shooting-method function to share

2006-11-09 Thread Pauli Virtanen
ke, 2006-11-08 kello 16:08 -0800, David L Goldsmith kirjoitti: > Hi! I tried to send this earlier: it made it into my sent mail folder, > but does not appear to have made it to the list. > > I need to numerically solve: > (1-t)x" + x' - x = f(t), x(0) = x0, x(1) = x1 > I've been trying to us

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-09 Thread Tim Hochberg
A. M. Archibald wrote: > On 08/11/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > > >> It has always been my experience (on various flavors or Pentium) that >> operating on NANs is extremely slow. Does anyone know on what hardware >> NANs are *not* slow? Of course it's always possible I just never

Re: [Numpy-discussion] Grief with a complex value

2006-11-09 Thread Colin J. Williams
Stefan van der Walt wrote: > On Thu, Nov 09, 2006 at 03:18:57AM -0500, Colin J. Williams wrote: > >> >>> import numpy.core as _n >> >>> _nt= _n.numerictypes >> >>> value= >> '[EMAIL PROTECTED]@[EMAIL PROTECTED]@\x00\x00\x00\x00\x00\x00\x18@' >> >>> _n.array(value, dtype= _nt.complex128, c

[Numpy-discussion] filter a recarray

2006-11-09 Thread Brent Pedersen
hi, i have a recarray of  > 60K  records and i'm wondering if there's a numpy/vectorized way to the following.get a new array where there will be unique column0 + column1 rows with the row that remains being chosen because it has the highest value in the last column. so in the paste below, there ar

Re: [Numpy-discussion] Anyone have a "little" shooting-method function to share

2006-11-09 Thread David L Goldsmith
Wow, thanks! DG Pauli Virtanen wrote: > ke, 2006-11-08 kello 16:08 -0800, David L Goldsmith kirjoitti: > >> Hi! I tried to send this earlier: it made it into my sent mail folder, >> but does not appear to have made it to the list. >> >> I need to numerically solve: >> (1-t)x" + x' - x =

Re: [Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Christopher Barker
Robert Kern wrote: > I think we decided long ago that an int32 really is an array of 32-bit > integers > and behaves like one. That would apply to y*y: >>> x = 99 >>> y = numpy.array([x]) >>> x*x 9801L So Python ints automatically convert to Python longs on overflow. >>> y*y a

Re: [Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Tim Hochberg
Robert Kern wrote: > Fernando Perez wrote: > >> I understand why this happens, but I wonder if it should be in any way >> 'fixed' (if that is even feasible without introducing other problems): >> >> In [28]: x = 99 >> >> In [29]: y = numpy.array([x]) >> >> In [30]: z = y[0] >> >> In [31]: x=

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-09 Thread Eric Firing
It looks like on my Pentium M multiplication with NaNs is slow, but using a masked array ranges from slightly faster (with only one value masked) to twice as slow (with all values masked): In [15]:Timer("a.prod()", "import numpy as np; aa = np.ones(4096); a = np.ma.masked_greater(aa,0)").timei

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-09 Thread Christopher Barker
Tim Hochberg wrote: > I've been told that operations on NANs are slow because they aren't > always implemented in the FPU hardware. Instead they are trapped and > implemented software or firmware or something or other. which still doesn't make sense -- doesn't ANY operation with a NaN return N

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-09 Thread Tim Hochberg
Christopher Barker wrote: > Tim Hochberg wrote: > >> I've been told that operations on NANs are slow because they aren't >> always implemented in the FPU hardware. Instead they are trapped and >> implemented software or firmware or something or other. >> > > which still doesn't make sens

Re: [Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Robert Kern
Christopher Barker wrote: > I'm a bit confused, because I thought that when you extracted a scalar > from an array, you got regular python scalar for the datatypes that are > supported. This made it clear that you always get a numpy Scalar, which, > in a few situations, behaves differently than

Re: [Numpy-discussion] Int32s, scalar operations and Pyhon longs

2006-11-09 Thread Fernando Perez
On 11/9/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > Let me add that I can't imagine that the bugs will be all that subtle > given that numpy now spits out a warning on overflow. > If you're really worried about this I suggest you crank up the error > mode to make this an error - then you really

Re: [Numpy-discussion] "Slicing" recarrays

2006-11-09 Thread Christopher Barker
Travis Oliphant wrote: > How about > > newdtype = N.dtype([('both','2i4'),('','b1')]) > res = data.view(newdtype)['both'] That works great! thanks, -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voic

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-09 Thread Paul Dubois
Disappointed in NaN land?Since the function of old retired persons is to tell youngsters stories around the campfile:A supercomputer hardware designer told me that when forced to add IEEE arithmetic to his designs that it decreased performance substantially, maybe 25-30%; it wasn't that doing the o

Re: [Numpy-discussion] slice assignment: strange behaviour

2006-11-09 Thread koara
Ok, so i installed the newest numpy and scipy over enthought defaults. The original problem indeed disappeared! Given the highly suspicous magic threshold number of 1, i suspect it was a bug in old numpy. Makes me wonder if it's really been solved or just stopped manifesting itself in my test d

Re: [Numpy-discussion] Grief with a complex value

2006-11-09 Thread joris
[CJ]: I didn't find "frombuffer" in the Numpy Examples List. I just added a frombuffer() example (the 197th example!) which I extracted from your mail. [CJ]: Incidentally, the List is a big help but it would be even better if [CJ]: included the signatures of the functions. Good id

Re: [Numpy-discussion] (no subject)

2006-11-09 Thread miki
:―― INFORMATION ―: 不正・悪質なサイトを一切排除しておりますので 安心してご利用ください。 http://love-match.bz/pc/04 :――: *・゜゜・*:.。. .。.:*・゜゜・*:.。..。:*・゜゜・*:.。..。:**・゜゜・* ━━━  □■ 不倫・ワリキリ専門の無料出会いサイト『Love☆Match』  ---

[Numpy-discussion] automatic differentiation using custom ndarray?

2006-11-09 Thread Matthew Koichi Grimes
I'd love to be able to do automatic differentiation using numpy ndarrays. There are some AD libraries in C++ that work through operator overloading on custom numeric types (e.g. "adouble"). I have no experience in in creating custom ndarrays, but would it be a huge project (or even possible) to mak

Re: [Numpy-discussion] Stacking arrays...

2006-11-09 Thread Christopher Barker
Pau Gargallo wrote: > c=N.dstack([a,b]) seems to do the trick. indeed it does. Thanks. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98

[Numpy-discussion] [OT] Why Python 'fits your brain'

2006-11-09 Thread Fernando Perez
Please forgive the not-specifically-numpy post. I'll keep it short. Some of us often, when trying to explain to newcomers the benefits of Python for scientific work, use expressions like the famous 'it fits your brain'. This is an attempt at conveying why it seems like such a natural tool for exp

Re: [Numpy-discussion] [OT] Why Python 'fits your brain'

2006-11-09 Thread Bill Baxter
I think Ruby users say the same about Ruby, maybe even more emphatically than Python users, and Ruby's chart looks like just about the most complicated one there. C and Python look to be about on par. Also I suspect a chart of Lisp's grammar would be even simpler than any of those up there, but I

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-09 Thread A. M. Archibald
On 09/11/06, Paul Dubois <[EMAIL PROTECTED]> wrote: > Since the function of old retired persons is to tell youngsters stories > around the campfile: I'll pull up a log. But since I'm uppity, and not especially young, I hope you won't mind if I heckle. > A supercomputer hardware designer told me