Re: [Numpy-discussion] [ANN] NumPy 1.0b4 now available

2006-08-28 Thread Bruce Who
Hi, Travis I can pack my scripts into an executable with py2exe, but errors occur once it runs: No scipy-style subpackage 'random' found in D:\test\dist\numpy. Ignoring: No module named info import core -> failed: No module named _internal import lib -> failed: 'module' object has no attribute '_

Re: [Numpy-discussion] Is numpy supposed to support the buffer protocol?

2006-08-28 Thread Robin Dunn
Travis Oliphant wrote: > Christopher Barker wrote: >> HI all, >> >> File >> "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", >> line 2814, in SetDataBuffer >> return _core_.Image_SetDataBuffer(*args, **kwargs) >> TypeError: non-character array cannot be interpreted as chara

[Numpy-discussion] A minor annoyance with MA

2006-08-28 Thread PGM
Folks, I keep running into the following problem since some recent update (I'm currently running 1.0b3, but the problem occurred roughly around 0.9.8): >>> import numpy.core.ma as MA >>> x=MA.array([[1],[2]],mask=False) >>> x.sum(None) /usr/lib64/python2.4/site-packages/numpy/core/ma.py in reduc

Re: [Numpy-discussion] tensor dot ?

2006-08-28 Thread Bill Baxter
On 8/29/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Example: > > If a.shape is (3,4,5) > and b.shape is (4,3,2) > > Then > > tensordot(a, b, axes=([1,0],[0,1])) > > returns a (5,2) array which is equivalent to the code: > > c = zeros((5,2)) > for i in range(5): > for j in range(2): >

Re: [Numpy-discussion] tensor dot ?

2006-08-28 Thread Travis Oliphant
Simon Burton wrote: numpy.dot.__doc__ > matrixproduct(a,b) > Returns the dot product of a and b for arrays of floating point types. > Like the generic numpy equivalent the product sum is over > the last dimension of a and the second-to-last dimension of b. > NB: The first argumen

Re: [Numpy-discussion] std(axis=1) memory footprint issues + moving avg / stddev

2006-08-28 Thread Torgil Svensson
> The C-code is basically a directy "translation" of the original Python > code. ... > If I had to do it over again, I would place the std implementation there where > it could be appropriately optimized. Isn't C-code a good place for optimizations? //Torgil On 8/27/06, Travis Oliphant <[EMAIL

Re: [Numpy-discussion] 1.0b4 problem continuted from 1.0b3

2006-08-28 Thread Torgil Svensson
This is really a matplotlib problem. >From matplotlib users mailing-list archives: > From: Charlie Moad <[EMAIL PROTECTED]> > Snapshot build for use with numpy-1.0b3 > 2006-08-23 06:11 > > Here is a snapshot of svn this morning for those wanting to work with the numpy beta. Both builds are for

Re: [Numpy-discussion] Is numpy supposed to support the buffer protocol?

2006-08-28 Thread Robert Kern
Christopher Barker wrote: > While I'm a great advocate of the new array protocol, it seems > supporting the buffer protocol also would be a good idea. I've enclosed > some simple test code. It works with numarray, but not numpy 1.0b4 Instead of I.SetDataBuffer(some_array) you can use I

Re: [Numpy-discussion] Is numpy supposed to support the buffer protocol?

2006-08-28 Thread Travis Oliphant
Christopher Barker wrote: > HI all, > > File > "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", > line 2814, in SetDataBuffer > return _core_.Image_SetDataBuffer(*args, **kwargs) > TypeError: non-character array cannot be interpreted as character buffer > > If I try to pass

[Numpy-discussion] Is numpy supposed to support the buffer protocol?

2006-08-28 Thread Christopher Barker
HI all, Robin Dunn has been working on adding better support for dumping data directly to wxPython from the num* packages. I've been talking to him about the new array interface, and he might well support it (particularly if one of us contributes code), but in the meantime, he's got a number

Re: [Numpy-discussion] request for new array method: arr.abs()

2006-08-28 Thread Christopher Barker
Travis Oliphant wrote: > I think I prefer to just add the float, bool, object, unicode, str names > to the "non-imported" numpy > name-space. which mean you get it with: import numpy as N N.float but not with from numpy import * ? If that's what you mean, then I'm all for it! -Chris --

Re: [Numpy-discussion] 1.0b4 problem continuted from 1.0b3

2006-08-28 Thread Travis Oliphant
[EMAIL PROTECTED] wrote: > On 8/25/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: >> >>> Message: 4 >>> Date: Thu, 24 Aug 2006 14:17:44 -0600 >>> From: Travis Oliphant <[EMAIL PROTECTED]> >>> Subject: Re: [Numpy-discussion] (no subject) >>> To: Discussion of Nu

[Numpy-discussion] 1.0b4 problem continuted from 1.0b3

2006-08-28 Thread kortmann
On 8/25/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > Message: 4 > > Date: Thu, 24 Aug 2006 14:17:44 -0600 > > From: Travis Oliphant <[EMAIL PROTECTED]> > > Subject: Re: [Numpy-discussion] (no subject) > > To: Discussion of Numerical Python > > > > Message-I

[Numpy-discussion] weave using numeric or numpy?

2006-08-28 Thread Carlos Pita
Hi all!I'm rewriting some swig-based extensions that implement intensive inner loops dealing with numeric/numpy arrays. The intention is to build these extensions by means of weave inline, ext_module, ext_function, etc. I'm not sure about how to point weave to my numpy instalation. By default it tr

Re: [Numpy-discussion] Numeric/numpy incompatibility

2006-08-28 Thread Travis Oliphant
Andrew Straw wrote: > The following code indicates there is a problem adding a numpy scalar > type to a Numeric array. Is this expected behavior or is there a bug > somewhere? > There was a bug in the __array_struct__ attribute of array flags wherein the NOTSWAPPED flag was not being set as it

Re: [Numpy-discussion] numpy1.04b4: undefined symbol: PyUnicodeUCS2_FromUnicode. error No _WIN32

2006-08-28 Thread rex
Travis Oliphant <[EMAIL PROTECTED]> [2006-08-28 12:42]: > rex wrote: > > ImportError: /usr/lib/python2.4/site-packages/numpy/core/multiarray.so: > > undefined symbol: PyUnicodeUCS2_FromUnicode > > > > > > > > This error usually means that NumPy was built and linked against a > Python build wh

[Numpy-discussion] Numeric/numpy incompatibility

2006-08-28 Thread Andrew Straw
The following code indicates there is a problem adding a numpy scalar type to a Numeric array. Is this expected behavior or is there a bug somewhere? This bit me in the context of updating some of my code to numpy, while part of it still uses Numeric. import Numeric import numpy print 'Numeric._

Re: [Numpy-discussion] request for new array method: arr.abs()

2006-08-28 Thread Travis Oliphant
Christopher Barker wrote: > Travis Oliphant wrote: > > >> Instead, I like better the idea of adding abs, round, max, and min to >> the "non-import-*" namespace of numpy. >> > > Another I'd like is the built-in data types. I always use: > > import numpy as N > > so then I do: > > a = zeros(

Re: [Numpy-discussion] numpy1.04b4: undefined symbol: PyUnicodeUCS2_FromUnicode. error No _WIN32

2006-08-28 Thread Travis Oliphant
rex wrote: > Numpy builds, but fails to run with the error message: > > >> python >> > Python 2.4.2 (#1, Apr 24 2006, 18:13:30) > [GCC 4.1.0 (SUSE 10.1 Linux)] on linux2 > import numpy > Traceback (most recent call last): > File "", line 1, in ? > File "/usr/lib/py

Re: [Numpy-discussion] request for new array method: arr.abs()

2006-08-28 Thread Christopher Barker
Travis Oliphant wrote: > Instead, I like better the idea of adding abs, round, max, and min to > the "non-import-*" namespace of numpy. Another I'd like is the built-in data types. I always use: import numpy as N so then I do: a = zeros(shape, float) or a = zeros(shape, N.float_) but for non

[Numpy-discussion] numpy1.04b4: undefined symbol: PyUnicodeUCS2_FromUnicode. error No _WIN32

2006-08-28 Thread rex
Numpy builds, but fails to run with the error message: > python Python 2.4.2 (#1, Apr 24 2006, 18:13:30) [GCC 4.1.0 (SUSE 10.1 Linux)] on linux2 >>> import numpy Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/numpy/__init__.py", line 35, in ?

Re: [Numpy-discussion] C Api newbie question

2006-08-28 Thread Matt Knox
>>Matt Knox wrote:>>> Hi there. I'm in the unfortunate situation of trying to track down a >> memory error in someone elses code, and to make matters worse I don't >> really know jack squat about C programming. The problem seems to arise >> when several numpy arrays are created from C arrays in t

Re: [Numpy-discussion] memory corruption bug

2006-08-28 Thread Bill Baxter
Nope, that's the way python works in general for any type other than basic scalar types. >>> a = [1,2,3,4] >>> b = a >>> b[1] = 99 >>> print a [1, 99, 3, 4] >>> print b [1, 99, 3, 4] Also the issue never comes up for types like tuples or strings because they aren't mutable. --bb On 8/28/06, Sven

Re: [Numpy-discussion] memory corruption bug

2006-08-28 Thread Sven Schreiber
Charles R Harris schrieb: > +1. I too suspect that what you have here is a reference/copy problem. > The only thing that is local to the class is the reference (pointer), > the data is global. > > Chuck Ok, so you guys were right, turns out that my problem was caused by the fact that a local assi

Re: [Numpy-discussion] Optimizing mean(axis=0) on a 3D array

2006-08-28 Thread Martin Spacek
Martin Spacek wrote: > > Actually, your original version is just as fast as the take() version. > Both are about 9X faster than numpy.mean() on my system. I prefer the > take() version because you only have to pass a single argument to > mean_accum() I forgot to mention that all my indices ar

Re: [Numpy-discussion] Optimizing mean(axis=0) on a 3D array

2006-08-28 Thread Martin Spacek
Tim Hochberg wrote: > I'm actually surprised that the take version is faster than my original > version since it makes a big ol' copy. I guess this is an indication > that indexing is more expensive than I realize. That's why nothing beats > measuring! Actually, your original version is just