[Numpy-discussion] nan, sign, and all that

2008-10-01 Thread Charles R Harris
Hi All, I've added ufuncs fmin and fmax that behave as follows: In [3]: a = array([NAN, 0, NAN, 1]) In [4]: b = array([0, NAN, NAN, 0]) In [5]: fmax(a,b) Out[5]: array([ 0., 0., NaN, 1.]) In [6]: fmin(a,b) Out[6]: array([ 0., 0., NaN, 0.]) In [7]: fmax.reduce(a) Out[7]: 1.0 In [8

[Numpy-discussion] complex numpy.ndarray dtypes

2008-10-01 Thread John Gu
Hello, I am using numpy in conjunction with pyTables. The data that I read in from pyTables seem to have the following dtype: p = hdf5.root.myTable.read() p.__class__ p[0].__class__ p.dtype dtype([('time', ' Traceback (most recent call last) p:\AsiaDesk\johngu\projects\deltaFor

[Numpy-discussion] Portable functions for nans, signbit, etc.

2008-10-01 Thread Charles R Harris
The normal signbit function of gcc without the -std=c99 flag doesn't work correctly for nans and infs. I found the following code on a boost mailing list and it might be helpful here for portability. const boost::uint32_t signbit_mask = binary_cast(1.0f) ^ binary_cast(-1.0f); inline boo

Re: [Numpy-discussion] Vectorization of the product of several matrices ?

2008-10-01 Thread Charles R Harris
On Wed, Oct 1, 2008 at 7:16 PM, Charles R Harris <[EMAIL PROTECTED]>wrote: > > > On Wed, Oct 1, 2008 at 2:46 PM, oc-spam66 <[EMAIL PROTECTED]> wrote: > >> Hello and thank you for your answer. >> >> > There are at least three methods I can think of, but choosing the best >> one >> > requires more i

[Numpy-discussion] Help to process a large data file

2008-10-01 Thread frank wang
Hi, I have a large data file which contains 2 columns of data. The two columns only have zero and one. Now I want to cound how many one in between if both columns are one. For example, if my data is: 1 0 0 0 1 1 0 0 0 1x 0 1x 0 0 0 1x 1 1 0 0 0 1x 0 1x 1 1 Then my

Re: [Numpy-discussion] Vectorization of the product of several matrices ?

2008-10-01 Thread Charles R Harris
On Wed, Oct 1, 2008 at 2:46 PM, oc-spam66 <[EMAIL PROTECTED]> wrote: > Hello and thank you for your answer. > > > There are at least three methods I can think of, but choosing the best > one > > requires more information. How long are the lists? Do the arrays have > > variable dimensions? The simp

Re: [Numpy-discussion] Texas Python Regional Unconference Reminders

2008-10-01 Thread Steve Lianoglou
Hi, Are there any plans to tape the presentations? Unfortunately some of us can't make it down to Texas, but the talks look quite interesting. Thanks, -steve On Oct 1, 2008, at 10:36 AM, Travis Vaught wrote: > Greetings, > > The Texas Python Regional Unconference is coming up this weekend > (

Re: [Numpy-discussion] Vectorization of the product of several matrices ?

2008-10-01 Thread oc-spam66
Hello and thank you for your answer. > There are at least three methods I can think of, but choosing the best one > requires more information. How long are the lists? Do the arrays have > variable dimensions? The simplest and most adaptable method is probably The lists would be made of 4x4 matric

[Numpy-discussion] f2py IS NOW WORKING

2008-10-01 Thread Blubaugh, David A.
To all, I have now been able to develop a stable file via f2py!! However, I had to execute the following: 1.) First, I had to copy all required library files from my selected Compaq visual Fortran compiler under python's scripts directory along with f2py itself. 2.) I also had to include a

Re: [Numpy-discussion] PyArray_Resize reference counting

2008-10-01 Thread Ravi
On Tuesday 30 September 2008 18:54:21 Travis E. Oliphant wrote: > I just went to the code and noticed that PyArray_Resize returns None.   > So, you certainly don't want to point array to it.  The array does not > get any reference count changes. Thanks for the very clear explanation. > PyObject *

[Numpy-discussion] Texas Python Regional Unconference Reminders

2008-10-01 Thread Travis Vaught
Greetings, The Texas Python Regional Unconference is coming up this weekend (October 4-5) and I wanted to send out some more details of the meeting. The web page for the meeting is here: http://www.scipy.org/TXUncon2008 The meeting is _absolutely free_, so please add yourself to the Atten

Re: [Numpy-discussion] why type(array(1).tolist()) is int?

2008-10-01 Thread dmitrey
Alan G Isaac wrote: > On 10/1/2008 9:04 AM dmitrey apparently wrote: > >> why array(1).tolist() returns 1? I expected to get [1] instead. >> > > I guess I would expect it not to work at all. > Given that it does work, this seems the best result. > What list shape matches the shape of a 0-d

Re: [Numpy-discussion] will array(Python set) be ever implemented as cast method?

2008-10-01 Thread Travis E. Oliphant
dmitrey wrote: > hi all, > will array(Python set) (and asarray, asfarray etc) ever be implemented > as cast method? > Use fromiter instead.We could special case set objects in array(...) if that is deemed desirable. -Travis ___ Numpy-discuss

Re: [Numpy-discussion] why type(array(1).tolist()) is int?

2008-10-01 Thread Travis E. Oliphant
dmitrey wrote: > let me also note that list(array((1))) returns > > Traceback (innermost last): > File "", line 1, in > TypeError: iteration over a 0-d array > > D. > This is expected. 0-d arrays are currently not iterable. -Travis ___ Numpy-disc

Re: [Numpy-discussion] why type(array(1).tolist()) is int?

2008-10-01 Thread Alan G Isaac
On 10/1/2008 9:04 AM dmitrey apparently wrote: > why array(1).tolist() returns 1? I expected to get [1] instead. I guess I would expect it not to work at all. Given that it does work, this seems the best result. What list shape matches the shape of a 0-d array? What is the use case that makes thi

[Numpy-discussion] will array(Python set) be ever implemented as cast method?

2008-10-01 Thread dmitrey
hi all, will array(Python set) (and asarray, asfarray etc) ever be implemented as cast method? Now it just puts the set into 1st element: >>> asarray(set([11, 12, 13, 14])) array(set([11, 12, 13, 14]), dtype=object) >>> array(set([11, 12, 13, 14])) array(set([11, 12, 13, 14]), dtype=object)

Re: [Numpy-discussion] why type(array(1).tolist()) is int?

2008-10-01 Thread dmitrey
let me also note that list(array((1))) returns Traceback (innermost last): File "", line 1, in TypeError: iteration over a 0-d array D. dmitrey wrote: > hi all, > why array(1).tolist() returns 1? I expected to get [1] instead. > D. > > ___ > Numpy-di

[Numpy-discussion] why type(array(1).tolist()) is int?

2008-10-01 Thread dmitrey
hi all, why array(1).tolist() returns 1? I expected to get [1] instead. D. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-10-01 Thread James Philbin
> distances, indices = T.query(xs) # single nearest neighbor I'm not sure if it's implied, but can xs be a NxD matrix here i.e. query for all N points rather than just one. This will reduce the python call overhead for large queries. Also, I have some c++ code for locality sensitive hashing which

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-10-01 Thread Anne Archibald
2008/10/1 Barry Wark <[EMAIL PROTECTED]>: > Thanks for taking this on. The scikits.ann has licensing issues (as > noted above), so it would be nice to have a clean-room implementation > in scipy. I am happy to port the scikits.ann API to the final API that > you choose, however, if you think that

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-10-01 Thread Brian Blais
On Sep 30, 2008, at 23:16 , Lisandro Dalcin wrote: On Tue, Sep 30, 2008 at 9:27 PM, Brian Blais <[EMAIL PROTECTED]> thanks for all of the help. My initial solution is to pickle my object, with the text-based version of pickle, and send it across rpc. I do this because the actual thing I am

Re: [Numpy-discussion] Proposal: scipy.spatial

2008-10-01 Thread Anne Archibald
2008/10/1 Gael Varoquaux <[EMAIL PROTECTED]>: > On Tue, Sep 30, 2008 at 06:10:46PM -0400, Anne Archibald wrote: >> > k=None in the third call to T.query seems redundant. It should be >> > possible do put some logics so that the call is simply > >> > distances, indices = T.query(xs, distance_upper_b

Re: [Numpy-discussion] xml-rpc with numpy arrays

2008-10-01 Thread Vincent Schut
Lisandro Dalcin wrote: > > I believe xmlrpclib is currently the simpler approach. Some day I'll > have the time to implement something similar using MPI communication > with mpi4py. However, I believe it can be done even better: local, > client-side proxies should automatically provide access to a