Re: [Numpy-discussion] convert integer into bit array

2011-05-16 Thread Pearu Peterson
On Tue, May 17, 2011 at 8:05 AM, Pearu Peterson wrote: > > > On Tue, May 17, 2011 at 12:04 AM, Nikolas Tautenhahn wrote: > >> Hi, >> >> > Here >> > >> > >> http://code.google.com/p/pylibtiff/source/browse/#svn%2Ftrunk%2Flibtiff%2Fbitarray-0.3.5-numpy >> > >> > you can find bitarray with numpy supp

Re: [Numpy-discussion] convert integer into bit array

2011-05-16 Thread Pearu Peterson
On Tue, May 17, 2011 at 12:04 AM, Nikolas Tautenhahn wrote: > Hi, > > > Here > > > > > http://code.google.com/p/pylibtiff/source/browse/#svn%2Ftrunk%2Flibtiff%2Fbitarray-0.3.5-numpy > > > > you can find bitarray with numpy support. > > > > Thanks, that looks promising - to get a numpy array, I ne

Re: [Numpy-discussion] PyArray_ContiguousFromObject & PyDECREF

2011-05-16 Thread Hyunsoo Noh
Hi, I think it should give the memory leaking. I have a similar issue. I am wondering if it works fine when using Py_DECREF() in the code. In my case, I tried to decref the PyArrayObject using Py_DECREF() but it gives a segmentation fault. Instead, if I use the PyArray_XDECREF(), it doesn't gi

Re: [Numpy-discussion] convert integer into bit array

2011-05-16 Thread Tom Krauss
Here's a one-liner: In [31]: x=np.arange(-8,8) In [32]: x Out[32]: array([-8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7]) In [33]: 1&(x[:,np.newaxis]/2**np.arange(3,-1,-1)) Out[33]: array([[1, 0, 0, 0], [1, 0, 0, 1], [1, 0, 1, 0], [1, 0, 1, 1], [1, 1,

Re: [Numpy-discussion] Need to eliminate a nested loop

2011-05-16 Thread Elfnor
Thanks that works well Execution time is down from ~3 seconds to 0.06 seconds Eleanor -- View this message in context: http://old.nabble.com/Need-to-eliminate-a-nested-loop-tp31591457p31633558.html Sent from the Numpy-discussion mailing list archive at Nabble.com. ___

Re: [Numpy-discussion] convert integer into bit array

2011-05-16 Thread Nikolas Tautenhahn
Hi, > Here > > http://code.google.com/p/pylibtiff/source/browse/#svn%2Ftrunk%2Flibtiff%2Fbitarray-0.3.5-numpy > > you can find bitarray with numpy support. > Thanks, that looks promising - to get a numpy array, I need to do numpy.array(bitarray.bitarray(numpy.binary_repr(i, l))) for an inte

[Numpy-discussion] Performance issues with numpy cross tabulation

2011-05-16 Thread Justin Thomas
Hello, I am having trouble with performance when trying to create a cross tabulation using numpy. Ideally, I would calculate each cell in the cross tabulation separately because this gives me the greatest amount of flexibility. I have included some sample code as a reference and am really looki

Re: [Numpy-discussion] convert integer into bit array

2011-05-16 Thread Pearu Peterson
Hi, I have used bitarray for that http://pypi.python.org/pypi/bitarray/ Here http://code.google.com/p/pylibtiff/source/browse/#svn%2Ftrunk%2Flibtiff%2Fbitarray-0.3.5-numpy you can find bitarray with numpy support. HTH, Pearu On Mon, May 16, 2011 at 9:55 PM, Nikolas Tautenhahn wrote: > H

Re: [Numpy-discussion] ANN: NumPy 1.6.0 [Problems on OS X w/ Python 2.6 and XCode 4]

2011-05-16 Thread Ralf Gommers
On Mon, May 16, 2011 at 8:30 PM, Andrew Jaffe wrote: > On 16/05/2011 18:45, Ralf Gommers wrote: > > > > On Mon, May 16, 2011 at 12:41 PM, Andrew Jaffe > > wrote: > > > > Dear all, > > > > I have OSX 10.6.7, XCode 4, and Python.org python 2.6.6 and 2.7.1, > whe

[Numpy-discussion] convert integer into bit array

2011-05-16 Thread Nikolas Tautenhahn
Hi, for some research, I need to convert lots of integers into their bit representation - but as a bit array, not a string like numpy.binary_repr() returns it. So instead of In [22]: numpy.binary_repr(23) Out[22]: '10111 I'd need: numpy.binary_magic(23) Out: array([ True, False, True, True,

Re: [Numpy-discussion] ANN: NumPy 1.6.0 [Problems on OS X w/ Python 2.6 and XCode 4]

2011-05-16 Thread Andrew Jaffe
On 16/05/2011 18:45, Ralf Gommers wrote: > > On Mon, May 16, 2011 at 12:41 PM, Andrew Jaffe > wrote: > > Dear all, > > I have OSX 10.6.7, XCode 4, and Python.org python 2.6.6 and 2.7.1, where > 2.7 is 64-bit. > > With 2.7, easy_install successfully compi

Re: [Numpy-discussion] ANN: NumPy 1.6.0 [Problems on OS X w/ Python 2.6 and XCode 4]

2011-05-16 Thread Ralf Gommers
On Mon, May 16, 2011 at 12:41 PM, Andrew Jaffe wrote: > Dear all, > > I have OSX 10.6.7, XCode 4, and Python.org python 2.6.6 and 2.7.1, where > 2.7 is 64-bit. > > With 2.7, easy_install successfully compiles and installs the package, > both over the web and with an explicit download. > > With 2.

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Hoyt Koepke
> I might go that way: I already have pure-Python code that implements it > and that I have been using for a year or so. Fair enough -- though you'd probably get a big speed up moving to cython. >> It's a little slower on large graphs, but it still is pretty quick. > > Can you put any numbers on

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Gael Varoquaux
On Mon, May 16, 2011 at 09:15:21AM -0700, Hoyt Koepke wrote: > > Thanks for the suggestion. Unfortunately, I do not want to add compiled > > code (or an external dependency) to the scikit for this solver, as it is > > a fairly minor step for us. I particular chances are that it will never > > be a

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Hoyt Koepke
In this case, lemon exists only as C++ header files, with no compiled code. A few cython functions should make it pretty simple. However, yeah, it is a bit heavyweight. > Thanks for the suggestion. Unfortunately, I do not want to add compiled > code (or an external dependency) to the scikit for

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Gael Varoquaux
Hey On Mon, May 16, 2011 at 08:49:58AM -0700, Hoyt Koepke wrote: > On Mon, May 16, 2011 at 12:18 AM, Gael Varoquaux > wrote: > > Jonker-Volgenant algorithm for best linear assignment in Python, using > > numpy. Unsuprisingly, it is proving time-costly. I cannot afford to spend > > too much time o

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Hoyt Koepke
On Mon, May 16, 2011 at 12:18 AM, Gael Varoquaux wrote: > Following a suggestion by Joseph, I am trying to implement the > Jonker-Volgenant algorithm for best linear assignment in Python, using > numpy. Unsuprisingly, it is proving time-costly. I cannot afford to spend > too much time on this, as

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Charles R Harris
On Mon, May 16, 2011 at 7:07 AM, wrote: > On Mon, May 16, 2011 at 8:53 AM, Charles R Harris > wrote: > > > > > > On Mon, May 16, 2011 at 1:18 AM, Gael Varoquaux > > wrote: > >> > >> Following a suggestion by Joseph, I am trying to implement the > >> Jonker-Volgenant algorithm for best linear as

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread josef . pktd
On Mon, May 16, 2011 at 8:53 AM, Charles R Harris wrote: > > > On Mon, May 16, 2011 at 1:18 AM, Gael Varoquaux > wrote: >> >> Following a suggestion by Joseph, I am trying to implement the >> Jonker-Volgenant algorithm for best linear assignment in Python, using >> numpy. Unsuprisingly, it is pro

Re: [Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Charles R Harris
On Mon, May 16, 2011 at 1:18 AM, Gael Varoquaux < gael.varoqu...@normalesup.org> wrote: > Following a suggestion by Joseph, I am trying to implement the > Jonker-Volgenant algorithm for best linear assignment in Python, using > numpy. Unsuprisingly, it is proving time-costly. I cannot afford to sp

Re: [Numpy-discussion] ANN: NumPy 1.6.0 [Problems on OS X w/ Python 2.6 and XCode 4]

2011-05-16 Thread Andrew Jaffe
Dear all, I have OSX 10.6.7, XCode 4, and Python.org python 2.6.6 and 2.7.1, where 2.7 is 64-bit. With 2.7, easy_install successfully compiles and installs the package, both over the web and with an explicit download. With 2.6, there seems to be a problem with attempting to compile the PPC ar

[Numpy-discussion] Linear assignment problem: Jonker-Volgenant algorithm

2011-05-16 Thread Gael Varoquaux
Following a suggestion by Joseph, I am trying to implement the Jonker-Volgenant algorithm for best linear assignment in Python, using numpy. Unsuprisingly, it is proving time-costly. I cannot afford to spend too much time on this, as it not to solve a problem of mine, but for the scikits.learn. Thu