Re: [Numpy-discussion] inplace operations

2007-01-26 Thread Christopher Barker
BBands wrote: > If I have a NumPy array like so: > > [[1, 12], > [2, 13], > [3, 14], > [4, 15], > [5, 16], > [6, 15], > [7, 14]] > > How can I do an inplace diff, ending up with this? > > [[1, 0], > [2, 1], > [3, 1], > [4, 1], > [5, 1], > [6, -1], > [7, -1]] >>> import numpy as N

Re: [Numpy-discussion] inplace operations

2007-01-26 Thread Travis Oliphant
BBands wrote: >If I have a NumPy array like so: > >[[1, 12], > [2, 13], > [3, 14], > [4, 15], > [5, 16], > [6, 15], > [7, 14]] > >How can I do an inplace diff, ending up with this? > >[[1, 0], > [2, 1], > [3, 1], > [4, 1], > [5, 1], > [6, -1], > [7, -1]] > > Probably can be done (but it's a bit

[Numpy-discussion] inplace operations

2007-01-26 Thread BBands
If I have a NumPy array like so: [[1, 12], [2, 13], [3, 14], [4, 15], [5, 16], [6, 15], [7, 14]] How can I do an inplace diff, ending up with this? [[1, 0], [2, 1], [3, 1], [4, 1], [5, 1], [6, -1], [7, -1]] Also, can I covert to natural logs in place? [[1, 2.4849], [2, 2.5649], [

Re: [Numpy-discussion] Arrays of poly1d objects, is this a bug?

2007-01-26 Thread Fernando Perez
On 1/26/07, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Stefan correctly identified the problem. The dimension-discovery code > is getting confused. > This might actually be a fixable bug. But, in general getting the > N.array() code to correctly guess where the "Object-line" should be > draw

Re: [Numpy-discussion] Arrays of poly1d objects, is this a bug?

2007-01-26 Thread Travis Oliphant
Fernando Perez wrote: >Hi all, > >I'm puzzled by this behavior a colleague ran into: > >In [38]: p1=N.poly1d([1.]) > >In [39]: a=N.array([p1],dtype='O') > >In [40]: a >Out[40]: array([], shape=(1, 0), dtype=object) > >In [42]: print a >[] > > > Stefan correctly identified the problem. The dim

Re: [Numpy-discussion] C-API: deallocating a partial ly filled object array

2007-01-26 Thread Martin Wiechert
On Friday 26 January 2007 21:45, Travis Oliphant wrote: > Martin Wiechert wrote: > >On Friday 26 January 2007 21:03, Robert Kern wrote: > >>Martin Wiechert wrote: > >>>Hi gurus, > >>> > >>>is it (in C) safe to deallocate an array of type NPY_OBJECT, which > >>>carries NULL pointers? > >> > >>Possib

Re: [Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Travis Oliphant
Martin Wiechert wrote: >On Friday 26 January 2007 21:03, Robert Kern wrote: > > >>Martin Wiechert wrote: >> >> >>>Hi gurus, >>> >>>is it (in C) safe to deallocate an array of type NPY_OBJECT, which >>>carries NULL pointers? >>> >>> >>Possibly, I'm not sure without doing some more code-

Re: [Numpy-discussion] Build numpy without support of "long double' on OS-X

2007-01-26 Thread Robert Kern
Sebastian Haase wrote: > On 1/26/07, Robert Kern <[EMAIL PROTECTED]> wrote: >> Sebastian Haase wrote: >> >>> The easiest would be to be able to disable the long double functions. >> Actually, there are a number of other configuration items that are >> discovered by >> compiling small C programs an

Re: [Numpy-discussion] Build numpy without support of "long double' on OS-X

2007-01-26 Thread Sebastian Haase
On 1/26/07, Robert Kern <[EMAIL PROTECTED]> wrote: > Sebastian Haase wrote: > > > The easiest would be to be able to disable the long double functions. > > Actually, there are a number of other configuration items that are discovered > by > compiling small C programs and running them. There are a

Re: [Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Martin Wiechert
On Friday 26 January 2007 21:03, Robert Kern wrote: > Martin Wiechert wrote: > > Hi gurus, > > > > is it (in C) safe to deallocate an array of type NPY_OBJECT, which > > carries NULL pointers? > > Possibly, I'm not sure without doing some more code-diving. However, I > strongly doubt that many othe

Re: [Numpy-discussion] Build numpy without support of "long double' on OS-X

2007-01-26 Thread Robert Kern
Sebastian Haase wrote: > The easiest would be to be able to disable the long double functions. Actually, there are a number of other configuration items that are discovered by compiling small C programs and running them. There are a number of them that might give different answers on 10.3.9 if th

Re: [Numpy-discussion] Arrays of poly1d objects, is this a bug?

2007-01-26 Thread Stefan van der Walt
On Fri, Jan 26, 2007 at 12:25:27PM -0700, Fernando Perez wrote: > Hi all, > > I'm puzzled by this behavior a colleague ran into: > > In [38]: p1=N.poly1d([1.]) > > In [39]: a=N.array([p1],dtype='O') > > In [40]: a > Out[40]: array([], shape=(1, 0), dtype=object) > > In [42]: print a > [] > >

Re: [Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Robert Kern
Martin Wiechert wrote: > Hi gurus, > > is it (in C) safe to deallocate an array of type NPY_OBJECT, which carries > NULL pointers? Possibly, I'm not sure without doing some more code-diving. However, I strongly doubt that many other operations are safe. Depending on how you got such an array and

[Numpy-discussion] C-API: deallocating a partially filled object array

2007-01-26 Thread Martin Wiechert
Hi gurus, is it (in C) safe to deallocate an array of type NPY_OBJECT, which carries NULL pointers? TIA, Martin ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] Arrays of poly1d objects, is this a bug?

2007-01-26 Thread Fernando Perez
Hi all, I'm puzzled by this behavior a colleague ran into: In [38]: p1=N.poly1d([1.]) In [39]: a=N.array([p1],dtype='O') In [40]: a Out[40]: array([], shape=(1, 0), dtype=object) In [42]: print a [] In [43]: N.__version__ Out[43]: '1.0.2.dev3512' He saw it running r3520 as well. This looks

Re: [Numpy-discussion] setmember1d memory leak?

2007-01-26 Thread Robert Kern
Charles R Harris wrote: > This would be easy to add. I could put in an option side='mask' that > would return 1 if the object is found, 0 otherwise. The type would be > integer rather than boolean but I don't see that as a big problem. If I > add that, I would like to change the keyword to mode in

Re: [Numpy-discussion] average() or mean() errors

2007-01-26 Thread Christopher Hanley
I filed a similar bug report the other day. I believe that it has to do with the default size of the accumulator variable in the algorithms being used. Please see the following example, Python 2.4.3 (#2, Dec 7 2006, 11:01:45) [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin Type "help"

Re: [Numpy-discussion] setmember1d memory leak?

2007-01-26 Thread Charles R Harris
On 1/25/07, Robert Cimrman <[EMAIL PROTECTED]> wrote: Robert Cimrman wrote: > Charles R Harris wrote: >> >> In [7]: def countmembers(a1, a2) : >> ...: a = sort(a2) >> ...: il = a.searchsorted(a1, side='l') >> ...: ir = a.searchsorted(a1, side='r') >> ...: return ir - il >

Re: [Numpy-discussion] average() or mean() errors

2007-01-26 Thread Stefan van der Walt
On Tue, Jan 23, 2007 at 08:29:47PM -0500, Daniel Smith wrote: > When calling the average() or mean() functions on a small array (3 > numbers), I am seeing significant numerical errors (on the order of 1% > with data to 8 significant digits). The code I am using is essentially: > > A = zeros(3) >

Re: [Numpy-discussion] average() or mean() errors

2007-01-26 Thread Keith Goodman
On 1/23/07, Daniel Smith <[EMAIL PROTECTED]> wrote: > When calling the average() or mean() functions on a small array (3 > numbers), I am seeing significant numerical errors (on the order of 1% > with data to 8 significant digits). The code I am using is essentially: > > A = zeros(3) > > A[i] = X >

[Numpy-discussion] average() or mean() errors

2007-01-26 Thread Daniel Smith
When calling the average() or mean() functions on a small array (3 numbers), I am seeing significant numerical errors (on the order of 1% with data to 8 significant digits). The code I am using is essentially: A = zeros(3) A[i] = X B = average(A) Is there something else I need to call to get

[Numpy-discussion] failed to build numpy and Numeric in Windows

2007-01-26 Thread Zhou, Mi
Hi, I am trying to build Numpy-1.01 in windows using "python setup.py build". My C compiler is MSVS2005. The compiler throws an error about umathmodule.c: "__umath_generated.c(72): error C2099: initializer is not a constant." Tried with Numeric-24.2, it gives the same error. The line of code

[Numpy-discussion] PyGame Port

2007-01-26 Thread Travis Oliphant
I just finished porting PyGame to use NumPy. It seemed to work fine. I ran only a few demos though, and so haven't fleshed out all the details. Please encourage library-writers to use NumPy when possible. -Travis Index: src/surfarray.c =