Re: [Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Brent Pedersen
On Mon, Oct 27, 2008 at 2:45 PM, Ryan May <[EMAIL PROTECTED]> wrote: > Brent Pedersen wrote: >> On Mon, Oct 27, 2008 at 1:56 PM, Robert Kern <[EMAIL PROTECTED]> wrote: >>> On Mon, Oct 27, 2008 at 15:54, Erik Tollerud <[EMAIL PROTECTED]> wrote: Is there any straightforward way of notifying on c

Re: [Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Ryan May
Brent Pedersen wrote: > On Mon, Oct 27, 2008 at 1:56 PM, Robert Kern <[EMAIL PROTECTED]> wrote: >> On Mon, Oct 27, 2008 at 15:54, Erik Tollerud <[EMAIL PROTECTED]> wrote: >>> Is there any straightforward way of notifying on change of a numpy >>> array that leaves the numpy arrays still efficient? >

Re: [Numpy-discussion] ParallelProgramming wiki page

2008-10-27 Thread Robin
On Mon, Oct 27, 2008 at 9:17 PM, dmitrey <[EMAIL PROTECTED]> wrote: > As for the ParallelProgramming wiki page, there are some words in > section "Use parallel primitives" about numpy.dot still I can't > understand from the section: if I get numpy from sources and compile it > (via "python setup.py

Re: [Numpy-discussion] ParallelProgramming wiki page

2008-10-27 Thread dmitrey
Did you mean this one http://www.netlib.org/scalapack/pblas_qref.html ? As for the ParallelProgramming wiki page, there are some words in section "Use parallel primitives" about numpy.dot still I can't understand from the section: if I get numpy from sources and compile it (via "python setup.py

Re: [Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Brent Pedersen
On Mon, Oct 27, 2008 at 1:56 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Mon, Oct 27, 2008 at 15:54, Erik Tollerud <[EMAIL PROTECTED]> wrote: >> Is there any straightforward way of notifying on change of a numpy >> array that leaves the numpy arrays still efficient? > > Not currently, no. > > -

Re: [Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Pierre GM
On Monday 27 October 2008 16:54:09 Erik Tollerud wrote: > Is there any straightforward way of notifying on change of a numpy > array that leaves the numpy arrays still efficient? Erik, may be you could try the trick presented here : http://www.scipy.org/Subclasses in the __array_wrap__ section.

Re: [Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Robert Kern
On Mon, Oct 27, 2008 at 15:54, Erik Tollerud <[EMAIL PROTECTED]> wrote: > Is there any straightforward way of notifying on change of a numpy > array that leaves the numpy arrays still efficient? Not currently, no. -- Robert Kern "I have come to believe that the whole world is an enigma, a harml

Re: [Numpy-discussion] ParallelProgramming wiki page

2008-10-27 Thread Frédéric Bastien
Hi, Their exist open source version of parallel BLAS library. I modified the section "Use parallel primitives" to tell it. But my English is bad, so if someone can check it, it would be nice. Fred On Mon, Oct 27, 2008 at 4:24 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Mon, Oct 27, 2008 at 1

[Numpy-discussion] numpy array change notifier?

2008-10-27 Thread Erik Tollerud
Is there any straightforward way of notifying on change of a numpy array that leaves the numpy arrays still efficient? That is, I would like to do the following: class C: def __init__(self,arr): self.arr = arr #what code do put here? def notify(self): print 'do

Re: [Numpy-discussion] ParallelProgramming wiki page

2008-10-27 Thread Robert Kern
On Mon, Oct 27, 2008 at 15:20, Sebastien Binet <[EMAIL PROTECTED]> wrote: > On Monday 27 October 2008 12:56:56 Robin wrote: >> Hi, >> >> I made some changes to the ParallelProgramming wiki page to outline >> use of the (multi)processing module as well as the threading module. >> >> I'm very much no

Re: [Numpy-discussion] ParallelProgramming wiki page

2008-10-27 Thread Sebastien Binet
On Monday 27 October 2008 12:56:56 Robin wrote: > Hi, > > I made some changes to the ParallelProgramming wiki page to outline > use of the (multi)processing module as well as the threading module. > > I'm very much not an expert on this - just researched it for myself, > so please feel free to corr

Re: [Numpy-discussion] poly1d with complex coefficients doesn't integrate

2008-10-27 Thread Robert Kern
On Mon, Oct 27, 2008 at 15:07, Mark Bakker <[EMAIL PROTECTED]> wrote: > I seem to be able to create a poly1d instance with complex coefficients, and > it works correctly. But I cannot integrate it. Does poly1d not support > complex coefficients? Any reason why not, that shouldn't be too difficult,

[Numpy-discussion] poly1d with complex coefficients doesn't integrate

2008-10-27 Thread Mark Bakker
I seem to be able to create a poly1d instance with complex coefficients, and it works correctly. But I cannot integrate it. Does poly1d not support complex coefficients? Any reason why not, that shouldn't be too difficult, should it? Thanks, Mark >>> p = poly1d([1+1j,2+2j]) >>> p(2) (4+4j) >>> q=p

[Numpy-discussion] problems multiplying poly1d with number from array

2008-10-27 Thread Mark Bakker
Hello list - I can multiply a poly1d instance with a number, but when I multiply with a number from an array, the order matters. That seems a bug: >>> a = array([2]) >>> p = poly1d([1,2]) >>> print 2*p # Works 2 x + 4 >>> print a[0]*p # Doesn't work, returns an array [2 4] >>> print p*a[0] #

[Numpy-discussion] ParallelProgramming wiki page

2008-10-27 Thread Robin
Hi, I made some changes to the ParallelProgramming wiki page to outline use of the (multi)processing module as well as the threading module. I'm very much not an expert on this - just researched it for myself, so please feel free to correct/ extend/ delete as appropriate. Robin _

Re: [Numpy-discussion] (Late) summary of PEP-225 discussion at Scipy

2008-10-27 Thread Fernando Perez
On Mon, Oct 27, 2008 at 11:31 AM, Eric Firing <[EMAIL PROTECTED]> wrote: > James Philbin wrote: >> One operator which could be used is '%'. We could keep the current >> behaviour for ARRAY%SCALAR but have ARRAY%ARRAY as being matrix >> multiplication. It has the same precedence as *,/. >> > > No, h

Re: [Numpy-discussion] (Late) summary of PEP-225 discussion at Scipy

2008-10-27 Thread Eric Firing
James Philbin wrote: > One operator which could be used is '%'. We could keep the current > behaviour for ARRAY%SCALAR but have ARRAY%ARRAY as being matrix > multiplication. It has the same precedence as *,/. > No, having completely unrelated meanings for the same operator symbol sounds like a r

Re: [Numpy-discussion] How to do : x[i,j] = y[k, j] with k = i+sj

2008-10-27 Thread Robert Kern
On Mon, Oct 27, 2008 at 10:38, Nicolas ROUX <[EMAIL PROTECTED]> wrote: > Hi, > > Me again ;-) > I have now a new question to ask (I hope not too silly). > > How to do : > > for j in range(yHeight): > for i in range(xWidth): > x[j,i] = y[k,i] with k = numpy.mod(i+sj,yHeight) > > With efficien

[Numpy-discussion] any interest in including a second-order gradient?

2008-10-27 Thread Andrew Hawryluk
We wrote a simple variation on the gradient() function to calculate the second derivatives. Would there be any interest in including a gradient2() in numpy? Andrew def gradient2(f, *varargs): """Calculate the second-order gradient of an N-dimensional scalar function. Uses central diffe

[Numpy-discussion] How to do : x[i,j] = y[k, j] with k = i+sj

2008-10-27 Thread Nicolas ROUX
Hi, Me again ;-) I have now a new question to ask (I hope not too silly). How to do : for j in range(yHeight): for i in range(xWidth): x[j,i] = y[k,i] with k = numpy.mod(i+sj,yHeight) With efficient numpy code, without the double "for" ? Thanks, Cheers, Nicolas. -Original Me

Re: [Numpy-discussion] Optimization of loops

2008-10-27 Thread Kurt Smith
On Thu, Oct 23, 2008 at 5:55 PM, Pierre Yger <[EMAIL PROTECTED]> wrote: > > import bisect > my_list.sort() > time, ind = zip(*my_list) > for i in id_list : > beg = bisect.bisect_left(ind,i) >end = bisect.bisect_right(ind,i) >mylist.append(tim[beg:end]) > I've always found itertools.gr

Re: [Numpy-discussion] How to do: y[y

2008-10-27 Thread Anne Archibald
If what you are trying to do is actually ensure all data is within the range [a,b], you may be interested to know that python's % operator works on floating-point numbers: In [1]: -0.1 % 1 Out[1]: 0.90002 So if you want all samples in the range (0,1) you can just do y%=1. Anne 2008/

Re: [Numpy-discussion] (Late) summary of PEP-225 discussion at Scipy

2008-10-27 Thread David Warde-Farley
On 27-Oct-08, at 7:22 AM, James Philbin wrote: > One operator which could be used is '%'. We could keep the current > behaviour for ARRAY%SCALAR but have ARRAY%ARRAY as being matrix > multiplication. It has the same precedence as *,/. The problem is that it would monkey with existing semantics fo

Re: [Numpy-discussion] How to do: y[y

2008-10-27 Thread Nicolas ROUX
Thanks for all of you, for this fast and good reply ;-) Nicolas. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Douard Sent: Monday, October 27, 2008 12:51 PM To: numpy-discussion@scipy.org Subject: Re: [Numpy-discussion] How to do: y[y Hello, > >

Re: [Numpy-discussion] How to do: y[y

2008-10-27 Thread David Douard
Le Monday 27 October 2008 12:41:06 Nicolas ROUX, vous avez écrit : > Hello, > > I hope this is not a silly question ;-) > I have a Numpy array, and I want to process it with : > "if the value is lower than Threshold, then increase by Threshold" > > > I would like to translate it as: > y[y > To b

Re: [Numpy-discussion] [mailinglist] How to do: y[y

2008-10-27 Thread Gabriel Gellner
On Mon, Oct 27, 2008 at 12:45:44PM +0100, Uwe Schmitt wrote: > Nicolas ROUX schrieb: > > Hello, > > > > I hope this is not a silly question ;-) > > I have a Numpy array, and I want to process it with : > > "if the value is lower than Threshold, then increase by Threshold" > > > > > > I would like

Re: [Numpy-discussion] [mailinglist] How to do: y[y

2008-10-27 Thread Uwe Schmitt
Nicolas ROUX schrieb: > Hello, > > I hope this is not a silly question ;-) > I have a Numpy array, and I want to process it with : > "if the value is lower than Threshold, then increase by Threshold" > > > I would like to translate it as: > y[y Hi, your solution does not work, becaus the arr

Re: [Numpy-discussion] How to do: y[y

2008-10-27 Thread Gabriel Gellner
On Mon, Oct 27, 2008 at 12:41:06PM +0100, Nicolas ROUX wrote: > Hello, > > I hope this is not a silly question ;-) > I have a Numpy array, and I want to process it with : > "if the value is lower than Threshold, then increase by Threshold" > > > I would like to translate it as: > y[y You are

[Numpy-discussion] How to do: y[y

2008-10-27 Thread Nicolas ROUX
Hello, I hope this is not a silly question ;-) I have a Numpy array, and I want to process it with : "if the value is lower than Threshold, then increase by Threshold" I would like to translate it as: y[yhttp://projects.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] (Late) summary of PEP-225 discussion at Scipy

2008-10-27 Thread James Philbin
One operator which could be used is '%'. We could keep the current behaviour for ARRAY%SCALAR but have ARRAY%ARRAY as being matrix multiplication. It has the same precedence as *,/. James ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http: