Re: [Numpy-discussion] How to test f2py?

2010-02-25 Thread David Cournapeau
Charles R Harris wrote: > > > On Wed, Feb 24, 2010 at 1:15 AM, David Cournapeau > wrote: > > On Wed, Feb 24, 2010 at 1:51 PM, Charles R Harris > mailto:charlesr.har...@gmail.com>> wrote: > > > > > Boy, that code is *old*, it still uses Numeric ;) I

Re: [Numpy-discussion] Want cumsum-like function

2010-02-25 Thread Peter Shinners
On 02/24/2010 11:48 PM, Friedrich Romstedt wrote: > 2010/2/25 Peter Shinners: > >> I want a function that works like cumsum, but starts at zero, instead of >> starting with the first actual value. >> >> [...] >> >> tallies = np.cumsum(initial_array) >> np.subtract(tallies, tallies[0], tallies)

Re: [Numpy-discussion] Numpy array performance issue

2010-02-25 Thread Bruno Santos
After implementation all the possibilities we discuss yesterday mi fastest version is this one: index_nSize=numpy.arange(0,length,nSize) lsPhasedValues = numpy.unique1d(aLoci[numpy.where(aLoci[index_nSize]>0)]) ... bigaLoci = (aLoci>=r) k = (aLoci>=r).sum() This is taking around 0.12s for my tes

Re: [Numpy-discussion] Numpy array performance issue

2010-02-25 Thread Bruno Santos
I just realized that the line lsPhasedValues = numpy.unique1d(aLoci[numpy.where(aLoci[index_nSize]>0)]) does not work properly. How can I get the unique values of an array based on their indexes? 2010/2/25 Bruno Santos > After implementation all the possibilities we discuss yesterday mi fastest

Re: [Numpy-discussion] How to test f2py?

2010-02-25 Thread Charles R Harris
On Thu, Feb 25, 2010 at 1:07 AM, David Cournapeau wrote: > Charles R Harris wrote: > > > > > > On Wed, Feb 24, 2010 at 1:15 AM, David Cournapeau > > wrote: > > > > On Wed, Feb 24, 2010 at 1:51 PM, Charles R Harris > > mailto:charlesr.har...@gmail.com>> > wrote:

Re: [Numpy-discussion] Numpy array performance issue

2010-02-25 Thread Robert Kern
On Thu, Feb 25, 2010 at 07:51, Bruno Santos wrote: > I just realized that the line lsPhasedValues = > numpy.unique1d(aLoci[numpy.where(aLoci[index_nSize]>0)]) does not work > properly. > How can I get the unique values of an array based on their indexes? I don't know what that sentence means. Ple

Re: [Numpy-discussion] Numpy array performance issue

2010-02-25 Thread Bruno Santos
This is the same example we discuss yesterday. The working code is this one: lsPhasedValues = [aLoci[i] for i in xrange(length) if i%21==0 and aLoci[i]>0] I was able to get the same result after a while: aAux =aLoci[index_nSize] lsPhasedValues = numpy.unique1d(aAux[numpy.where(aAux>0)[0]]) I could

Re: [Numpy-discussion] Numpy array performance issue

2010-02-25 Thread Robert Kern
On Thu, Feb 25, 2010 at 10:20, Bruno Santos wrote: > This is the same example we discuss yesterday. I think I can help you this time, but when we ask for complete code, we mean complete, self-contained code that we can run immediately, not a fragment of code that needs variables to be initialized

Re: [Numpy-discussion] How to test f2py?

2010-02-25 Thread Kurt Smith
On Thu, Feb 25, 2010 at 8:39 AM, Charles R Harris wrote: > > > On Thu, Feb 25, 2010 at 1:07 AM, David Cournapeau > wrote: >> >> Charles R Harris wrote: >> > >> > >> > On Wed, Feb 24, 2010 at 1:15 AM, David Cournapeau > > > wrote: >> > >> >     On Wed, Feb 24, 2010 at 1:

Re: [Numpy-discussion] read ascii file with quote delimited strings

2010-02-25 Thread Warren Weckesser
Sam Tygier wrote: > Hi > > I am trying to read an ascii file which mixes ints, floats and stings. > eg. > 1 2.3 'a' 'abc ' > 2 3.2 'b' ' ' > 3 3.4 ' ' 'hello' > > Within a column that data is always the same. the strings are sometimes > contain with spaces. > Does each column always contai

Re: [Numpy-discussion] read ascii file with quote delimited strings

2010-02-25 Thread Chris Barker
Warren Weckesser wrote: > Does each column always contain the same number of characters? That >is, are > the field widths always the same? If so, you can ... if not, I'd use the std lib csv module, then convert to numpy arrays, not as efficient, but it should be easy. -Chris -- Christoph

[Numpy-discussion] problem w 32bit binomial?

2010-02-25 Thread James Bergstra
In case this hasn't been solved in more recent numpy... I've tried the following lines on two installations of numpy 1.3 with python 2.6  numpy.random.binomial(n=numpy.asarray([2,3,4], dtype='int64'), p=numpy.asarray([.1, .2, .3], dtype='float64')) A 64bit computer gives an output of array lengt

Re: [Numpy-discussion] problem w 32bit binomial?

2010-02-25 Thread David Warde-Farley
Hey James, On 25-Feb-10, at 5:59 PM, James Bergstra wrote: > In case this hasn't been solved in more recent numpy... > > I've tried the following lines on two installations of numpy 1.3 > with python 2.6 > > numpy.random.binomial(n=numpy.asarray([2,3,4], dtype='int64'), > p=numpy.asarray([.1,

Re: [Numpy-discussion] problem w 32bit binomial?

2010-02-25 Thread David Warde-Farley
On 25-Feb-10, at 5:59 PM, James Bergstra wrote: > In case this hasn't been solved in more recent numpy... > > I've tried the following lines on two installations of numpy 1.3 > with python 2.6 > > numpy.random.binomial(n=numpy.asarray([2,3,4], dtype='int64'), > p=numpy.asarray([.1, .2, .3], dty

Re: [Numpy-discussion] How to test f2py?

2010-02-25 Thread David Cournapeau
Kurt Smith wrote: > I'm the developer of fwrap. It is coming along, but will be at least > a month, likely two before the first release. (The main areas that > need some TLC are the fortran parser and the build system; the build > system will leverage numpy's distutils unless waf is easy to get

[Numpy-discussion] odd ascii format and genfromtxt

2010-02-25 Thread Ralf Gommers
Hi all, I'm trying to read in data from text files with genfromtxt, and have some trouble figuring out the right combination of keywords. The format is: ['0\t\t4.000e+007,0.000e+000\n', '\t9.860280631554179e-001,-1.902586503306264e-002\n', '\t9.860280631554179e-001,-1.90

[Numpy-discussion] anyone to look at #1402?

2010-02-25 Thread Nathaniel Smith
So there's this patch I submitted: http://projects.scipy.org/numpy/ticket/1402 Obviously not that high a priority in the grand scheme of things (it adds a function to compute the log-determinant directly), but I don't want to release a version of scikits.sparse with this functionality while the n