Re: [Numpy-discussion] simple array multiplication question

2009-10-12 Thread David Warde-Farley
On 12-Oct-09, at 11:53 PM, per freem wrote: > what i want to do is pick the columns l of p, and multiply each one by > the numbers in s. the first step, picking columns l of p, is simply: > > cols = p[arange(3), l] This isn't picking columns of p, this is picking the times at (0, 0), (1, 0), a

Re: [Numpy-discussion] [review] Easy win to improve numpy import times by 30 %

2009-10-12 Thread David Cournapeau
On Sat, Oct 10, 2009 at 2:49 PM, David Cournapeau wrote: > On Sat, Oct 10, 2009 at 1:24 AM, Peter > wrote: >> On Fri, Oct 9, 2009 at 5:56 AM, David Cournapeau >> wrote: >>> >>> Since inspect is used in quite a few places, and that we only use it to >>> extract arguments from a function, I added

[Numpy-discussion] simple array multiplication question

2009-10-12 Thread per freem
hi all, i am trying to write a simple product of 3 arrays (as vectorized code) but am having some difficulty. i have three arrays, one is a list containing several lists: p = array([[ 0.2, 0.8], [ 0.5, 0.5], [ 0.3, 0.7]]) each list in the array 'p' is of size N -- in this case N = 2. i have a

Re: [Numpy-discussion] performance of scipy: potential inefficiency in logsumexp and sampling from multinomial

2009-10-12 Thread Charles R Harris
On Mon, Oct 12, 2009 at 3:25 PM, per freem wrote: > hi all, > > i have a piece of code that relies heavily on sampling from > multinomial distributions and using their results to compute log > probabilities. my code makes heavy use of 'multinomial' from scipy, > and of 'logsumexp'. > > my code is

[Numpy-discussion] performance of scipy: potential inefficiency in logsumexp and sampling from multinomial

2009-10-12 Thread per freem
hi all, i have a piece of code that relies heavily on sampling from multinomial distributions and using their results to compute log probabilities. my code makes heavy use of 'multinomial' from scipy, and of 'logsumexp'. my code is unusually slow, and profiling it with Python's "cPickle" module r

Re: [Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread Gökhan Sever
On Mon, Oct 12, 2009 at 9:39 AM, Gökhan Sever wrote: > > > On Mon, Oct 12, 2009 at 9:18 AM, per freem wrote: > >> hi all, >> >> i'm trying to find nonzero elements in an array, as follows: >> >> a = array([[1, 0], >> [1, 1], >> [1, 1], >> [0, 1]]) >> >> i want to find all eleme

Re: [Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread Gökhan Sever
On Mon, Oct 12, 2009 at 9:18 AM, per freem wrote: > hi all, > > i'm trying to find nonzero elements in an array, as follows: > > a = array([[1, 0], > [1, 1], > [1, 1], > [0, 1]]) > > i want to find all elements that are [1,1]. i tried: nonzero(a == > [1,0]) but i cannot interpre

Re: [Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread josef . pktd
On Mon, Oct 12, 2009 at 10:18 AM, per freem wrote: > hi all, > > i'm trying to find nonzero elements in an array, as follows: > > a = array([[1, 0], >       [1, 1], >       [1, 1], >       [0, 1]]) > > i want to find all elements that are [1,1]. i tried: nonzero(a == > [1,0]) but i cannot interpre

[Numpy-discussion] finding nonzero elements in list

2009-10-12 Thread per freem
hi all, i'm trying to find nonzero elements in an array, as follows: a = array([[1, 0], [1, 1], [1, 1], [0, 1]]) i want to find all elements that are [1,1]. i tried: nonzero(a == [1,0]) but i cannot interpret the output. the output i get is: (array([0, 0, 1, 2]), array([0, 1

Re: [Numpy-discussion] October 16 Scientific Computing with Python Webinar: Traits

2009-10-12 Thread Virgil Stokes
Amenity Applewhite wrote: Having trouble viewing this email? Click here