Re: [Numpy-discussion] Faster

2008-05-02 Thread Hoyt Koepke
You know, for linkage clustering and BHC, I've found it a lot easier to work with an intermediate 1d map of indices and never resize the distance matrix. I then just remove one element from this map at each iteration, which is a LOT faster than removing a column and a row from a matrix. if idxmap

Re: [Numpy-discussion] svd and eigh

2008-05-02 Thread Nils Wagner
On Fri, 2 May 2008 23:34:19 -0700 (PDT) wilson <[EMAIL PROTECTED]> wrote: > I am trying out the eigenvectors related functions in >numpy.linalg.I > came across some portions where i have doubts. > 1). > i have an array X > if i calculate L=dot(X,X.transpose()) > can L be called the covariance m

[Numpy-discussion] svd and eigh

2008-05-02 Thread wilson
I am trying out the eigenvectors related functions in numpy.linalg.I came across some portions where i have doubts. 1). i have an array X if i calculate L=dot(X,X.transpose()) can L be called the covariance matrix of X?I read so in a paper by Turk&Pentland(equation 3 i think) can someone clarify t

Re: [Numpy-discussion] a possible way to implement a plogin system

2008-05-02 Thread David Cournapeau
Lisandro Dalcin wrote: > > Perhaps cleaner is not the right word. I actually believe that is far > more portable, regarding the oddities of dlopening in different > platforms. I am sorry, I don't understand why a struct is less sensitive to platform issues than function pointers when dynamically

Re: [Numpy-discussion] Faster

2008-05-02 Thread Robert Kern
On Fri, May 2, 2008 at 10:48 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 7:25 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > > In [5]: def kerndist(x): > >...: N = x.shape[0] > >...: x.flat[::N+1] = x.max() > >...: ij = argmin(x.flat) > >...

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 7:25 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > In [5]: def kerndist(x): >...: N = x.shape[0] >...: x.flat[::N+1] = x.max() >...: ij = argmin(x.flat) >...: i, j = divmod(ij, N) >...: return i, j I replaced ij = argmin(x.flat) with

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 7:36 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 8:02 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > If the clustering gives me useful results, I'll ask you about your > > boost code. I'll also take a look at Damian Eads's scipy-cluster. > > Tha

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 7:25 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 9:02 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > You're right. Finding the distance is slow. Is there any way to speed > > up the function below? It returns the row and column indices of the >

Re: [Numpy-discussion] Faster

2008-05-02 Thread Charles R Harris
On Fri, May 2, 2008 at 8:02 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 6:29 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > Isn't the lengthy part finding the distance between clusters? I can > think > > of several ways to do that, but I think you will get a real

Re: [Numpy-discussion] Faster

2008-05-02 Thread Robert Kern
On Fri, May 2, 2008 at 9:02 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 6:29 PM, Charles R Harris > > <[EMAIL PROTECTED]> wrote: > > > Isn't the lengthy part finding the distance between clusters? I can think > > of several ways to do that, but I think you will get a rea

Re: [Numpy-discussion] Faster

2008-05-02 Thread Charles R Harris
On Fri, May 2, 2008 at 8:02 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 6:29 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > Isn't the lengthy part finding the distance between clusters? I can > think > > of several ways to do that, but I think you will get a real

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 6:29 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > Isn't the lengthy part finding the distance between clusters? I can think > of several ways to do that, but I think you will get a real speedup by doing > that in c or c++. I have a module made in boost python that holds

Re: [Numpy-discussion] Faster

2008-05-02 Thread Charles R Harris
On Fri, May 2, 2008 at 7:16 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 6:05 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > > On Fri, May 2, 2008 at 7:24 PM, Keith Goodman <[EMAIL PROTECTED]> > wrote: > > > > > > > How can I make this function faster? It removes the i-th ro

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 6:05 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 7:24 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > > > How can I make this function faster? It removes the i-th row and > > column from an array. > > > > def cut(x, i): > > idx = range(x.sha

Re: [Numpy-discussion] Faster

2008-05-02 Thread Robert Kern
On Fri, May 2, 2008 at 7:24 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > How can I make this function faster? It removes the i-th row and > column from an array. > > def cut(x, i): > idx = range(x.shape[0]) > idx.remove(i) > y = x[idx,:] > y = y[:,idx] > return y > > >> imp

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 5:47 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > On Fri, May 2, 2008 at 5:38 PM, Charles R Harris > <[EMAIL PROTECTED]> wrote: > > On Fri, May 2, 2008 at 6:24 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > > How can I make this function faster? It removes the i-th r

Re: [Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
On Fri, May 2, 2008 at 5:38 PM, Charles R Harris <[EMAIL PROTECTED]> wrote: > On Fri, May 2, 2008 at 6:24 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > > How can I make this function faster? It removes the i-th row and > > column from an array. > > > > Why do you want to do that? Single linkage c

Re: [Numpy-discussion] Faster

2008-05-02 Thread Charles R Harris
On Fri, May 2, 2008 at 6:24 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > How can I make this function faster? It removes the i-th row and > column from an array. > Why do you want to do that? Chuck ___ Numpy-discussion mailing list Numpy-discussion@s

[Numpy-discussion] Faster

2008-05-02 Thread Keith Goodman
How can I make this function faster? It removes the i-th row and column from an array. def cut(x, i): idx = range(x.shape[0]) idx.remove(i) y = x[idx,:] y = y[:,idx] return y >> import numpy as np >> x = np.random.rand(500,500) >> timeit cut(x, 100) 100 loops, best of 3: 16.8

[Numpy-discussion] Ruby's NMatrix and NVector

2008-05-02 Thread Travis E. Oliphant
http://narray.rubyforge.org/matrix-e.html It seems they've implemented some of what Tim is looking for, in particular. Perhaps there is information to be gleaned from what they are doing. It looks promising.. -Travis ___ Numpy-discussion mailing

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Rich Shepard
On Fri, 2 May 2008, Christopher Barker wrote: > Why not just scale to -pi to pi right there? Dunno, Chris. As I wrote to Anne (including a couple of files and the resulting plot), it's been almost three decades since I dealt with the math underlying distribution functions. > Which is why you

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Christopher Barker
Anne Archibald wrote: > 2008/5/2 Rich Shepard <[EMAIL PROTECTED]>: > No, no. You *want* scaled_x to range from -1 to 1. Why not just scale to -pi to pi right there? (The 0.998 is because you didn't include the endpoint, 100.) Which is why you want linspace, rather than arange. Really, trust me

Re: [Numpy-discussion] [SciPy-dev] [IT] Maintenance and scheduled downtime this evening and weekend

2008-05-02 Thread Peter Wang
On May 2, 2008, at 5:45 PM, Damian Eads wrote: > Will this effect SVN and Trac access? > Thanks! > Damian Yes, this affects svn, trac, web, mailing lists,...everything, because we will be working on the underlying network infrastructure. -Peter ___

Re: [Numpy-discussion] [SciPy-dev] [IT] Maintenance and scheduled downtime this evening and weekend

2008-05-02 Thread Damian Eads
Will this effect SVN and Trac access? Thanks! Damian Peter Wang wrote: > Hi everyone, > > This evening and this weekend, we will be doing a major overhaul of > Enthought's internal network infrastructure. We will be cleaning up a > large amount of legacy structure and transitioning to a mo

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Anne Archibald
2008/5/2 Rich Shepard <[EMAIL PROTECTED]>: > On Fri, 2 May 2008, Anne Archibald wrote: > > > It's better not to work point-by-point, appending things, when working > > with numpy. Ideally you could find a formula which just produced the right > > curve, and then you'd apply it to the input vecto

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Rich Shepard
On Fri, 2 May 2008, Anne Archibald wrote: > It's better not to work point-by-point, appending things, when working > with numpy. Ideally you could find a formula which just produced the right > curve, and then you'd apply it to the input vector and get the output > vector all at once. Anne, T

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Anne Archibald
2008/5/2 Rich Shepard <[EMAIL PROTECTED]>: >What will work (I call it a pi curve) is a matched pair of sigmoid curves, > the ascending curve on the left and the descending curve on the right. Using > the Boltzmann function for these I can calculate and plot each individually, > but I'm havi

[Numpy-discussion] [IT] Maintenance and scheduled downtime this evening and weekend

2008-05-02 Thread Peter Wang
Hi everyone, This evening and this weekend, we will be doing a major overhaul of Enthought's internal network infrastructure. We will be cleaning up a large amount of legacy structure and transitioning to a more maintainable, better documented configuration. We have planned the work so tha

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Rich Shepard
On Fri, 2 May 2008, Christopher Barker wrote: > this could use some serious vectorization/numpyification! Poke around the > scipy Wiki and whatever other tutorials you can find -- you'll be glad you > did. A hint: > > When you are writing a loop like: >>for i in xL: >> x.append(xL

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Christopher Barker
Rich, this could use some serious vectorization/numpyification! Poke around the scipy Wiki and whatever other tutorials you can find -- you'll be glad you did. A hint: When you are writing a loop like: > for i in xL: > x.append(xL[i]) You should be doing array operations! Sp

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Rich Shepard
On Fri, 2 May 2008, Angus McMorland wrote: > How about multiplying two Boltzmann terms together, ala: > > f(x) = 1/(1+exp(-(x-flex1)/tau1)) * 1/(1+exp((x-flex2)/tau2)) > You'll find if your two flexion points get too close together, the peak > will drop below the maximum for each individual curve

Re: [Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Angus McMorland
2008/5/2 Rich Shepard <[EMAIL PROTECTED]>: >When I last visited I was given excellent advice about Gaussian and other > bell-shaped curves. Upon further reflection I realized that the Gaussian > curves will not do; the curve does need to have y=0.0 at each end. > >I tried to apply a Beta

[Numpy-discussion] Combining Sigmoid Curves

2008-05-02 Thread Rich Shepard
When I last visited I was given excellent advice about Gaussian and other bell-shaped curves. Upon further reflection I realized that the Gaussian curves will not do; the curve does need to have y=0.0 at each end. I tried to apply a Beta distribution, but I cannot correlate the alpha and bet

Re: [Numpy-discussion] a possible way to implement a plogin system

2008-05-02 Thread Lisandro Dalcin
On 5/1/08, David Cournapeau <[EMAIL PROTECTED]> wrote: > On Wed, 2008-04-30 at 16:44 -0300, Lisandro Dalcin wrote: > > David, in order to put clear what I was proposing to you in previous > > mail regarding to implementing plugin systems for numpy, please take a > > look at the attached tarball.

Re: [Numpy-discussion] Broadcasting question

2008-05-02 Thread Christopher Barker
Charles R Harris wrote: > A1 += A2[:,:,newaxis] is one way. Exactly what I was looking for -- thanks Charles (and Ann) -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R(206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Se

[Numpy-discussion] FW: HELP: PROBLEMS WITH VPYTHON, NUMPY AND PY2EXE PART 2

2008-05-02 Thread andres felipe sierra echeverry
Does anyone could help me generate an executable program that functions for the bounce.py with py2exe? Thank you bounce.py: from visual import * from numpy import * ball = sphere(pos=(0,4,0), color=color.red) example = zeros((10,10),dtype=float) print (example) setup.py: from