Re: [Numpy-discussion] 2-D function and meshgrid

2009-01-09 Thread Paulo J. S. Silva
Chuck, Thanks, your version is much faster. I would prefer a solution that doesn't force me to re-implement weirdDistance (as my two solutions were). But the function is so simple that it is easier just to re-write it for speed as you did. By the way, I came out with one more solution that looks

Re: [Numpy-discussion] 2-D function and meshgrid

2009-01-09 Thread Charles R Harris
On Fri, Jan 9, 2009 at 11:45 AM, Paulo J. S. Silva wrote: > Hello, > > I have a function that receives a array of shape (2,) and returns a > number (a function from R^2 -> R). It basically looks like this: > >def weirdDistance2(x): > return dot(dot(weirdMatrix, x), x) > > (weirdMatrix is

[Numpy-discussion] 2-D function and meshgrid

2009-01-09 Thread Paulo J. S. Silva
Hello, I have a function that receives a array of shape (2,) and returns a number (a function from R^2 -> R). It basically looks like this: def weirdDistance2(x): return dot(dot(weirdMatrix, x), x) (weirdMatrix is a "global" (2,2) array) I want to see its level sets in the box [0, 1]