Re: [Numpy-discussion] Distance Matrix speed

2006-06-20 Thread Alan G Isaac
I think the distance matrix version below is about as good as it gets with these basic strategies. fwiw, Alan Isaac def dist(A,B): rowsA, rowsB = A.shape[0], B.shape[0] distanceAB = empty( [rowsA,rowsB] , dtype=float) if rowsA <= rowsB: temp = empty_like(B) for i in r

[Numpy-discussion] C-API support for numarray added to NumPy

2006-06-20 Thread Travis Oliphant
C-API support for numarray is now checked in to NumPy SVN. With this support you should be able to compile numarray extensions by changing the include line from numarray/libnumarray.h to numpy/libnumarray.h You will also need to change the include directories used in compiling by appending th

Re: [Numpy-discussion] tiny patch + Playing with strings and my own array descr (PyArray_STRING, PyArray_OBJECT).

2006-06-20 Thread Travis Oliphant
Matthieu Perrot wrote: > hi, > > I need to handle strings shaped by a numpy array whose data own to a C > structure. There is several possible answers to this problem : > 1) use a numpy array of strings (PyArray_STRING) and so a (char *) object > in C. It works as is, but you need to define a m

[Numpy-discussion] what happened to numarray type names ?

2006-06-20 Thread Simon Burton
>>> import numpy >>> numpy.__version__ '0.9.9.2631' >>> numpy.Int32 Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'Int32' >>> This was working not so long ago. Simon. -- Simon Burton, B.Sc. Licensed PO Box 8066 ANU Canberra 2601 Au

Re: [Numpy-discussion] what happened to numarray type names ?

2006-06-20 Thread Stefan van der Walt
Hi Simon On Tue, Jun 20, 2006 at 08:22:30PM +0100, Simon Burton wrote: > > >>> import numpy > >>> numpy.__version__ > '0.9.9.2631' > >>> numpy.Int32 > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'module' object has no attribute 'Int32' > >>> > > This was workin

Re: [Numpy-discussion] strange bug

2006-06-20 Thread Tim Hochberg
Johannes Loehnert wrote: >Hi, > > > >>## Output: >>numpy.__version__: 0.9.8 >>y: [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] >>y**2: [ 0. 1. 4. 9. 16. 25. 36. 49. 64. 81.] >>z: [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] >>z**2: [ 0.e+00 1.e+00 1.6000e+01

[Numpy-discussion] foyoh test

2006-06-20 Thread Khalid Behan
roughness66.gif Description: GIF image ___ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Re: [Numpy-discussion] strange bug

2006-06-20 Thread Tim Hochberg
Tim Hochberg wrote: > Johannes Loehnert wrote: > >> Hi, >> >> >> >>> ## Output: >>> numpy.__version__: 0.9.8 >>> y: [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] >>> y**2: [ 0. 1. 4. 9. 16. 25. 36. 49. 64. 81.] >>> z: [ 0. 1. 2. 3. 4. 5. 6. 7. 8. 9.] >>> z**2: [ 0.000

[Numpy-discussion] Help for Windows Python, numpy and f2py

2006-06-20 Thread George Christianson
Good morning, I used the Windows installer to install Python 2.4.3 on a late-model Dell PC running XP Pro. Then I installed numpy-0.9.8 and scipy-0.4.9, also from the Windows installers. Now I am trying to build a dll file for a Fortran 77 file and previously-generated (Linux) pyf fi

Re: [Numpy-discussion] Help for Windows Python, numpy and f2py

2006-06-20 Thread Francesc Altet
A Dimarts 20 Juny 2006 18:17, George Christianson va escriure: > Good morning, Thank you, but here the sun is about to set ;-) > I used the Windows installer to install Python 2.4.3 on a late-model > Dell > PC running XP Pro. Then I installed numpy-0.9.8 and scipy-0.4.9, also from > the W

Re: [Numpy-discussion] Array interface updated to Version 3

2006-06-20 Thread Thomas Heller
Travis Oliphant schrieb: > I just updated the array interface page to emphasize we now have version > 3. NumPy still supports objects that expose (the C-side) of version 2 > of the array interface, though. > > The new interface is basically the same except (mostly) for asthetics: > The diff

Re: [Numpy-discussion] Array interface updated to Version 3

2006-06-20 Thread Travis Oliphant
Thomas Heller wrote: > Travis Oliphant schrieb: >> I just updated the array interface page to emphasize we now have >> version 3. NumPy still > > If current implementations of the array interface use this pointer for > other things (like keeping a reference to the array object), that's > fine,

Re: [Numpy-discussion] Array interface updated to Version 3

2006-06-20 Thread David M. Cooke
On Tue, 20 Jun 2006 21:05:51 +0200 Thomas Heller <[EMAIL PROTECTED]> wrote: > Travis Oliphant schrieb: > > I just updated the array interface page to emphasize we now have version > > 3. NumPy still supports objects that expose (the C-side) of version 2 > > of the array interface, though. > >

[Numpy-discussion] array creation speed comparison

2006-06-20 Thread Eric Firing
In the course of trying to speed up matplotlib, I did a little experiment that may indicate a place where numpy can be sped up: the creation of a 2-D array from a list of tuples. Using the attached script, I find that numarray is roughly 5x faster than either numpy or Numeric: [EMAIL PROTECT

Re: [Numpy-discussion] what happened to numarray type names ?

2006-06-20 Thread Erin Sheldon
The numpy example page still has dtype=Float and dtype=Int all over it. Is there a generic replacement for Float, Int or should these be changed to something more specific such as int32? Erin On 6/20/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > Hi Simon > > On Tue, Jun 20, 2006 at 08:22:3

Re: [Numpy-discussion] what happened to numarray type names ?

2006-06-20 Thread David M. Cooke
On Tue, Jun 20, 2006 at 09:00:52PM -0400, Erin Sheldon wrote: > The numpy example page still has dtype=Float and dtype=Int > all over it. Is there a generic replacement for Float, Int or should > these be changed to something more specific such as int32? > Erin float and int (the Python types) ar

[Numpy-discussion] Selecting columns of a matrix

2006-06-20 Thread Keith Goodman
I have a matrix M and a vector (n by 1 matrix) V. I want to form a new matrix that contains the columns of M for which V > 0. One way to do that in Octave is M(:, find(V > 0)). How is it done in numpy? ___ Numpy-discussion mailing list Numpy-discussion

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-20 Thread Bill Baxter
I think that one's on the NumPy for Matlab users, no? http://www.scipy.org/NumPy_for_Matlab_Users>>> import numpy as num >>> a = num.arange (10).reshape(2,5)>>> aarray([[0, 1, 2, 3, 4],   [5, 6, 7, 8, 9]])>>> v = num.rand(5)>>> varray([ 0.10934855,  0.55719644,  0.7044047 ,  0.19250088,  0.9463

Re: [Numpy-discussion] what happened to numarray type names ?

2006-06-20 Thread Erin Sheldon
OK, I have changed all the examples that used dtype=Float or dtype=Int to float and int. Erin On 6/20/06, David M. Cooke <[EMAIL PROTECTED]> wrote: > On Tue, Jun 20, 2006 at 09:00:52PM -0400, Erin Sheldon wrote: > > The numpy example page still has dtype=Float and dtype=Int > > all over it. Is th

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-20 Thread Keith Goodman
On 6/20/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > I think that one's on the NumPy for Matlab users, no? > > http://www.scipy.org/NumPy_for_Matlab_Users > > >>> import numpy as num > >>> a = num.arange (10).reshape(2,5) > >>> a > array([[0, 1, 2, 3, 4], >[5, 6, 7, 8, 9]]) > >>> v = num.r

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-20 Thread Erin Sheldon
On 6/20/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > I think that one's on the NumPy for Matlab users, no? > > http://www.scipy.org/NumPy_for_Matlab_Users > > >>> import numpy as num > >>> a = num.arange (10).reshape(2,5) > >>> a > array([[0, 1, 2, 3, 4], >[5, 6, 7, 8, 9]]) > >>> v = num.r

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-20 Thread Bill Baxter
On 6/21/06, Erin Sheldon <[EMAIL PROTECTED]> wrote: On 6/20/06, Bill Baxter <[EMAIL PROTECTED]> wrote:> I think that one's on the NumPy for Matlab users, no?>> http://www.scipy.org/NumPy_for_Matlab_Users>> >>> import numpy as num>  >>> a = num.arange (10).reshape(2,5)> >>> a> array([[0, 1, 2, 3, 4

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-20 Thread Simon Burton
On Wed, 21 Jun 2006 13:48:48 +0900 "Bill Baxter" <[EMAIL PROTECTED]> wrote: > > >>> a[:,num.where(v>0.5)[0]] > array([[1, 2, 4], >[6, 7, 9]]) > > I'll put that up on the Matlab->Numpy page. oh, yuck. What about this: >>> a[:,num.nonzero(v>0.5)] array([[0, 1, 3], [5, 6, 8]]) >>>