Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-19 Thread David Warde-Farley
On 19-Mar-10, at 1:13 PM, Anne Archibald wrote: > I'm not knocking numpy; it does (almost) the best it can. (I'm not > sure of the optimality of the order in which ufuncs are executed; I > think some optimizations there are possible.) But a language designed > from scratch for vector calculations

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-19 Thread Christopher Barker
Anne Archibald wrote: > (Which, honestly, makes me wonder what the point is of > building multicore machines.) Advertising... Oh, and having multiple cores slows down multi-threading in Python, so that feature is worth the expense! > But a language designed > from scratch for vector calculation

Re: [Numpy-discussion] Warnings in numpy.ma.test()

2010-03-19 Thread Pierre GM
On Mar 18, 2010, at 4:12 PM, Eric Firing wrote: > Ryan May wrote: >> On Thu, Mar 18, 2010 at 2:46 PM, Christopher Barker >> wrote: >>> Gael Varoquaux wrote: On Thu, Mar 18, 2010 at 12:12:10PM -0700, Christopher Barker wrote: > sure -- that's kind of my point -- if EVERY numpy array were >

Re: [Numpy-discussion] [OT] Starving CPUs article featured in IEEE's ComputingNow portal

2010-03-19 Thread Anne Archibald
On 18 March 2010 13:53, Francesc Alted wrote: > A Thursday 18 March 2010 16:26:09 Anne Archibald escrigué: >> Speak for your own CPUs :). >> >> But seriously, congratulations on the wide publication of the article; >> it's an important issue we often don't think enough about. I'm just a >> little

Re: [Numpy-discussion] np.resize differs from ndarray.resize

2010-03-19 Thread Alan G Isaac
On 3/18/2010 4:56 AM, Sebastian Haase wrote: > How would people feel about unifying the function vs. the method behavior ? > One could add an addition option like > `repeat` or `fillZero`. > One could (at first !?) keep opposite defaults to not change the > current behavior. > But this way it would

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Alan G Isaac
On 3/19/2010 10:53 AM, gerardob wrote: > I would like to know a simple way to generate a list containing all the > lists having two 1's at each element. > > Example, n = 4 > L2 = [[1,1,0,0],[1,0,1,0],[1,0,0,1],[0,1,1,0],[0,1,0,1],[0,0,1,1]] > I like list(set(itertools.permutations([1,1]+[0]*(n-2)

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread josef . pktd
On Fri, Mar 19, 2010 at 11:24 AM, wrote: > On Fri, Mar 19, 2010 at 11:17 AM, Keith Goodman wrote: >> On Fri, Mar 19, 2010 at 7:53 AM, gerardob wrote: >>> >>> Hello, i would like to produce lists of lists 1's and 0's. >>> >>> For example, to produce the list composed of: >>> >>> L = [[1,0,0,0],[

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread josef . pktd
On Fri, Mar 19, 2010 at 11:17 AM, Keith Goodman wrote: > On Fri, Mar 19, 2010 at 7:53 AM, gerardob wrote: >> >> Hello, i would like to produce lists of lists 1's and 0's. >> >> For example, to produce the list composed of: >> >> L = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] >> >> I just need to d

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Gökhan Sever
On Fri, Mar 19, 2010 at 10:17 AM, Joe Kington wrote: > See itertools.permutations (python standard library) > > e.g. > In [3]: list(itertools.permutations([1,1,0,0])) > Out[3]: > [(1, 1, 0, 0), > (1, 1, 0, 0), > (1, 0, 1, 0), > (1, 0, 0, 1), > (1, 0, 1, 0), > (1, 0, 0, 1), > (1, 1, 0, 0), >

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Joe Kington
I just realized that permutations isn't quite what you want, as swapping the first "1" for the second "1" gives the same thing. You can use set to get the unique permutations. e.g. In [4]: set(itertools.permutations([1,1,0,0])) Out[4]: set([(0, 0, 1, 1), (0, 1, 0, 1), (0, 1, 1, 0),

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Keith Goodman
On Fri, Mar 19, 2010 at 8:17 AM, Joe Kington wrote: > See itertools.permutations (python standard library) > e.g. > In [3]: list(itertools.permutations([1,1,0,0])) > Out[3]: > [(1, 1, 0, 0), >  (1, 1, 0, 0), >  (1, 0, 1, 0), >  (1, 0, 0, 1), >  (1, 0, 1, 0), >  (1, 0, 0, 1), >  (1, 1, 0, 0), >  (1

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Keith Goodman
On Fri, Mar 19, 2010 at 7:53 AM, gerardob wrote: > > Hello, i would like to produce lists of lists 1's and 0's. > > For example, to produce the list composed of: > > L = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] > > I just need to do the following: > > n=4 > numpy.eye(n,dtype=int).tolist() > > I w

Re: [Numpy-discussion] lists of zeros and ones

2010-03-19 Thread Joe Kington
See itertools.permutations (python standard library) e.g. In [3]: list(itertools.permutations([1,1,0,0])) Out[3]: [(1, 1, 0, 0), (1, 1, 0, 0), (1, 0, 1, 0), (1, 0, 0, 1), (1, 0, 1, 0), (1, 0, 0, 1), (1, 1, 0, 0), (1, 1, 0, 0), (1, 0, 1, 0), (1, 0, 0, 1), (1, 0, 1, 0), (1, 0, 0, 1), (0,

[Numpy-discussion] lists of zeros and ones

2010-03-19 Thread gerardob
Hello, i would like to produce lists of lists 1's and 0's. For example, to produce the list composed of: L = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] I just need to do the following: n=4 numpy.eye(n,dtype=int).tolist() I would like to know a simple way to generate a list containing all the l

Re: [Numpy-discussion] Warnings in numpy.ma.test()

2010-03-19 Thread Darren Dale
On Wed, Mar 17, 2010 at 10:16 PM, Charles R Harris wrote: > On Wed, Mar 17, 2010 at 7:39 PM, Darren Dale wrote: >> On Wed, Mar 17, 2010 at 8:22 PM, Charles R Harris >> > What bothers me here is the opposing desire to separate ufuncs from >> > their >> > ndarray dependency, having them operate on

Re: [Numpy-discussion] evaluating a function in a matrix element???

2010-03-19 Thread Sebastian Walter
On Thu, Mar 18, 2010 at 7:01 AM, Frank Horowitz wrote: > Dear All, > > I'm working on a piece of optimisation code where it turns out to be > mathematically convenient to have a matrix where a few pre-chosen elements > must be computed at evaluation time for the dot product (i.e. matrix > multi

[Numpy-discussion] evaluating a function in a matrix element???

2010-03-19 Thread Frank Horowitz
> >>> > class X: > > ... def __mul__(self, other): > ... return numpy.random.random() * other > ... def __rmul__(self, other): > ... return other * numpy.random.random() Thanks for that Friedrich! I had forgotten about __mul__, __rmul__, __float__ et al. I th