[Numpy-discussion] split() for slices?

2011-03-17 Thread Benjamin Root
Hello, I really like the split() family of functions, but I have the need to split multiple arrays in a similar manner, and it would seem logical to me to have a split() function that would return a list of slice tuples that I could use on multiple arrays. Is there such a function? Thanks, Ben R

Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread Andrey N. Sobolev
Hi eat and Gary, Thanks a lot for your suggestions, I've tried them in my code and achieved similar speedup of ~270% for both of them. So I guess I'll stick to one of those. Regards, Andrey. > Hi, > > On Thu, Mar 17, 2011 at 10:44 AM, Andrey N. Sobolev > wrote: > > > Dear all, > > > > Sorr

Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread santhu kumar
3).nonzero(), works out and finds the 5th row. > > Am i doing something wrong? > I basically want to find the rows whose fifth coloumn(4th in numpy matrix > format) is 2. > > Any suggestions? > Thanks > Santhosh > -- next part -- > An HTML attac

Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Mark Wiebe
On Thu, Mar 17, 2011 at 3:30 PM, Pauli Virtanen wrote: > Thu, 17 Mar 2011 15:23:19 -0700, Christopher Barker wrote: > > On 3/17/11 2:57 PM, Mark Wiebe wrote: > >> Dtypes being mutable looks like a serious bug to me, it's violating the > >> definition of 'hashable' given here: > > > > I can imagin

Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread Christopher Barker
On 3/17/11 3:17 PM, santhu kumar wrote: > nid = (res[:,4]==2).nonzero() > nid tuple turns out to be empty. But the very first row satisfies the > criteria. it works for me: In [45]: arr Out[45]: array([[ 33.35053669, 49.4615004 , 44.27631299, 1., 2. ], [ 32.84263059,

Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Pauli Virtanen
Thu, 17 Mar 2011 15:23:19 -0700, Christopher Barker wrote: > On 3/17/11 2:57 PM, Mark Wiebe wrote: >> Dtypes being mutable looks like a serious bug to me, it's violating the >> definition of 'hashable' given here: > > I can imagine other problems is would cause, as well -- is there any > reason th

Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread Warren Weckesser
On Thu, Mar 17, 2011 at 5:17 PM, santhu kumar wrote: > Hello all, > > I am new to Numpy. I used to program before in matlab and am getting used > to Numpy. > > I have a array like: > res > array([[ 33.35053669, 49.4615004 , 44.27631299, 1., 2. > ], >[ 32.84263059, 50.247520

Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Christopher Barker
On 3/17/11 2:57 PM, Mark Wiebe wrote: > Dtypes being mutable looks like a serious bug to me, it's violating the > definition of 'hashable' given here: I can imagine other problems is would cause, as well -- is there any reason that dtypes should be mutable? -Chris -- Christopher Barker, Ph.D

Re: [Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread Matthieu Brucher
Hi, Did you try np.where(res[:,4]==2) ? Matthieu 2011/3/17 santhu kumar > Hello all, > > I am new to Numpy. I used to program before in matlab and am getting used > to Numpy. > > I have a array like: > res > array([[ 33.35053669, 49.4615004 , 44.27631299, 1., 2. > ], >[ 3

[Numpy-discussion] Nonzero behaving strangely?

2011-03-17 Thread santhu kumar
Hello all, I am new to Numpy. I used to program before in matlab and am getting used to Numpy. I have a array like: res array([[ 33.35053669, 49.4615004 , 44.27631299, 1., 2. ], [ 32.84263059, 50.24752036, 43.92291659, 1., 0. ], [ 33.68999668, 48.9055467

Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Mark Wiebe
On Thu, Mar 17, 2011 at 2:35 PM, Robert Kern wrote: > On Wed, Mar 16, 2011 at 15:21, Mark Wiebe wrote: > > > That sounds like a good fix to me. Whenever objects compare equal, they > > should hash to the same value. > > There is a limit to how far we can actually satisfy this requirement. > For

Re: [Numpy-discussion] hashing dtypes, new variation, old theme

2011-03-17 Thread Robert Kern
On Wed, Mar 16, 2011 at 15:21, Mark Wiebe wrote: > That sounds like a good fix to me. Whenever objects compare equal, they > should hash to the same value. There is a limit to how far we can actually satisfy this requirement. For the implementation of np.dtype.__eq__(), we coerce the other argum

Re: [Numpy-discussion] ImportError: libatlas.so: cannot open shared object file: No such file or directory

2011-03-17 Thread Jose Borreguero
Unfortunately it didn't work. I did: > export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/atlas/lib > python setup.py build > python setup.py install Then in another terminal > export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/atlas/lib > python >>> import numpy >>>... >>>from numpy.linalg import lapack_lite

Re: [Numpy-discussion] ImportError: libatlas.so: cannot open shared object file: No such file or directory

2011-03-17 Thread Ilan Schnell
It looks like atlas wasn't linked right. If you /usr/local/atlas/lib to your LIBRARY_PATH environment variable it should work. - Ilan On Thu, Mar 17, 2011 at 12:23 PM, Jose Borreguero wrote: > Dear Numpy/Scipy users, > > I just installed numpy but I have an error when importing import nump

[Numpy-discussion] ImportError: libatlas.so: cannot open shared object file: No such file or directory

2011-03-17 Thread Jose Borreguero
Dear Numpy/Scipy users, I just installed numpy but I have an error when importing >>> import numpy from numpy.linalg import lapack_lite ImportError: libatlas.so: cannot open shared object file: No such file or directory I have ATLAS libraries under /usr/local/atlas/lib libatlas.a libcb

Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread Christopher Barker
On 3/17/11 12:46 AM, eat wrote: > I am try to read a file of the following format, I want to avoid > the first line and read the remaining as 'float' . > Please help me... > > > RainWindTempPrSal > 0.11.10.020.2 0.2 > 0.50. 0. 0

Re: [Numpy-discussion] Fortran was dead ... [was Re:rewriting NumPy code in C or C++ or similar]

2011-03-17 Thread Dag Sverre Seljebotn
On 03/17/2011 03:23 PM, Yung-Yu Chen wrote: On Wed, Mar 16, 2011 at 17:46, Dag Sverre Seljebotn mailto:d.s.seljeb...@astro.uio.no>> wrote: On 03/16/2011 10:14 PM, william ratcliff wrote: > Related to this, what is the status of fwrap? Can it be used with > fortran 95/2003 language

Re: [Numpy-discussion] Fortran was dead ... [was Re:rewriting NumPy code in C or C++ or similar]

2011-03-17 Thread Yung-Yu Chen
On Wed, Mar 16, 2011 at 17:46, Dag Sverre Seljebotn < d.s.seljeb...@astro.uio.no> wrote: > On 03/16/2011 10:14 PM, william ratcliff wrote: > > Related to this, what is the status of fwrap? Can it be used with > > fortran 95/2003 language features? There is a rather large code > > crystallographi

Re: [Numpy-discussion] Build ERROR ConfigParser.MissingSectionHeaderError: File contains no section headers

2011-03-17 Thread Jose Borreguero
Thanks Josef, that worked! I was confused because I was thinking of site.cfg as some sort of bash script :) Jose On Thu, Mar 17, 2011 at 12:40 AM, wrote: > On Thu, Mar 17, 2011 at 12:23 AM, Jose Borreguero > wrote: > > Dear Numpy/SciPy users, > > > > I have a build error with Numpy: > > > >

Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread dileep kunjaai
Thanks sir,, thanks a lot .. On Thu, Mar 17, 2011 at 1:16 PM, eat wrote: > Hi, > > On Thu, Mar 17, 2011 at 9:36 AM, dileep kunjaai > wrote: > >> Dear sir, >> I am try to read a file of the following format, I want to avoid the >> first line and read the remaining as 'float' . >> Please

Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread gary ruben
How about argmin(add.reduce((a*a),axis=1)) In [5]: a Out[5]: array([[ 0.24202827, 0.01269182, 0.95162307], [ 0.02979253, 0.454 , 0.49650111], [ 0.52626565, 0.08363861, 0.56444878], [ 0.89639659, 0.54259354, 0.29245881], [ 0.75301013, 0.6248646 , 0.245658

Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread eat
Hi, On Thu, Mar 17, 2011 at 10:44 AM, Andrey N. Sobolev wrote: > Dear all, > > Sorry if that's a noob question, but anyway. I have several thousands of > vectors stacked in 2d array. I'd like to get new array containing > Euclidean norms of these vectors and get the vector with minimal norm. > >

[Numpy-discussion] Norm of array of vectors

2011-03-17 Thread Andrey N. Sobolev
Dear all, Sorry if that's a noob question, but anyway. I have several thousands of vectors stacked in 2d array. I'd like to get new array containing Euclidean norms of these vectors and get the vector with minimal norm. Is there more efficient way to do this than argmin(array([sqrt(dot(x,x)) fo

Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread eat
Hi, On Thu, Mar 17, 2011 at 9:36 AM, dileep kunjaai wrote: > Dear sir, > I am try to read a file of the following format, I want to avoid the first > line and read the remaining as 'float' . > Please help me... > > > RainWindTempPrSal > 0.11.10.020.2 0.2 > 0.50.

[Numpy-discussion] avoid a line...

2011-03-17 Thread dileep kunjaai
Dear sir, I am try to read a file of the following format, I want to avoid the first line and read the remaining as 'float' . Please help me... RainWindTempPrSal 0.11.10.020.2 0.2 0.50. 0. 0.4 0.8 0.55.51.50.5 1.5 3.50.51.5