[Numpy-discussion] distance_matrix: how to speed up?

Vincent Schut schut@sarvision...
Thu May 22 05:52:08 CDT 2008


Rob Hetland wrote:
> On May 22, 2008, at 9:45 AM, Vincent Schut wrote:
> 
<snip>
> 
> Really, though, the rbf toolbox will not be limited by the memory of  
> the distance matrix.  Later on, you need to do a large linear algebra  
> 'solve', like this:
> 
> 
> r = norm(x, x) # The distances between all of the ND points to each  
> other.
> A = psi(r)  # where psi is some divergent function, often the  
> multiquadratic function : sqrt((self.epsilon*r)**2 + 1)
> coefs = linalg.solve(A, data)  # where data is the length of x, one  
> data point for each spatial point.
> 
> # to find the interpolated data points at xi
> ri = norm(xi, x)
> Ai = psi(ri)
> di = dot(Ai, coefs)
> 
> 
> All in all, it is the 'linalg.solve' that kills you.

Ah, indeed, my memory was faulty, I'm afraid. It was in this phase that 
it halted, not in the distance calculations.

Vincent.

> 
> -Rob
> 
> ----
> Rob Hetland, Associate Professor
> Dept. of Oceanography, Texas A&M University
> http://pong.tamu.edu/~rob
> phone: 979-458-0096, fax: 979-845-6331



More information about the Numpy-discussion mailing list