Re: [Numpy-discussion] Fixed-point arithemetic...any solution yet?

2009-12-10 Thread Norbert Nemec
Dag Sverre Seljebotn wrote: > I haven't heard of anything, but here's what I'd do: > - Use np.int64 > - Multiply all inputs to my code with 10^6 > - Divide all output from my code with 10^6 > - If you need to debug-print and array, simply define something like > > FIXED_POINT_FACTOR = 10*

Re: [Numpy-discussion] min() of array containing NaN

2008-08-14 Thread Norbert Nemec
Travis E. Oliphant wrote: > Thomas J. Duck wrote: > >> Determining the minimum value of an array that contains NaN produces >> a surprising result: >> >> >>> x = numpy.array([0,1,2,numpy.nan,4,5,6]) >> >>> x.min() >> 4.0 >> >> I expected 0.0. Is this the intended behaviour or a bug? I am u

Re: [Numpy-discussion] diff of find of diff trick

2007-10-11 Thread Norbert Nemec
Basically, what you want to do is a histogram. Numpy has that functionality built in. However: the version built in to numpy is about as suboptimal as yours. The problem is the unnecessary sorting of the data. In principle, a histogram does not need any sorting, so it could be done in strictly O(N

[Numpy-discussion] Bug in numarray<->numpy interaction

2006-12-24 Thread Norbert Nemec
The following snippet demonstrates a problem in the interaction of numarray 1.5.2 with numpy 1.0.1 (and older versions): --- #!/usr/bin/env python import numarray, numpy na = numarray.array(0.) np = numpy.array(0.) na[...] = np --- the last linec causes the erro