Re: [Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Stefan van der Walt
Hi Sameer On Mon, Aug 20, 2007 at 06:26:30PM -0500, Sameer DCosta wrote: > On 8/20/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > Thanks Stefan for offering to take a closer look. I have attached a > patch against the latest svn which fixes this problem. Yup, right on the money. The __seta

[Numpy-discussion] NumPy 1.0.3.1 released

2007-08-20 Thread Jarrod Millman
I'm pleased to announce the release of NumPy 1.0.3.1 This a minor bug fix release, which enables the latest release of SciPy to build. Bug-fixes === * Add back get_path to numpy.distutils.misc_utils * Fix 64-bit zgeqrf * Add parenthesis around GETPTR macros Thank you to everybody who

Re: [Numpy-discussion] "Extended" Outer Product

2007-08-20 Thread Charles R Harris
On 8/20/07, Geoffrey Zhu <[EMAIL PROTECTED]> wrote: > > Hi Everyone, > > I am wondering if there is an "extended" outer product. Take the > example in "Guide to Numpy." Instead of doing an multiplication, I > want to call a custom function for each pair. > > >>> print outer([1,2,3],[10,100,1000]) >

Re: [Numpy-discussion] "Extended" Outer Product

2007-08-20 Thread Christopher Barker
Robert Kern wrote: > If you can code your function such that it only uses operations that broadcast > (i.e. operators and ufuncs) and avoids things like branching or loops, then > you > can just use numpy.newaxis on the first array. > > from numpy import array, newaxis > x = array([1, 2, 3])

Re: [Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Sameer DCosta
On 8/20/07, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > This looks like a bug, since > > a[0][0] = 0 > > works fine. I'll take a closer look and make sure. > Thanks Stefan for offering to take a closer look. I have attached a patch against the latest svn which fixes this problem. Both thi

Re: [Numpy-discussion] "Extended" Outer Product

2007-08-20 Thread Robert Kern
Geoffrey Zhu wrote: > Hi Everyone, > > I am wondering if there is an "extended" outer product. Take the > example in "Guide to Numpy." Instead of doing an multiplication, I > want to call a custom function for each pair. > print outer([1,2,3],[10,100,1000]) > > [[ 10 100 1000] > [ 20 200 20

[Numpy-discussion] "Extended" Outer Product

2007-08-20 Thread Geoffrey Zhu
Hi Everyone, I am wondering if there is an "extended" outer product. Take the example in "Guide to Numpy." Instead of doing an multiplication, I want to call a custom function for each pair. >>> print outer([1,2,3],[10,100,1000]) [[ 10 100 1000] [ 20 200 2000] [ 30 300 3000]] So I want: [ [f

Re: [Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Stefan van der Walt
On Mon, Aug 20, 2007 at 08:34:53AM -0500, Sameer DCosta wrote: > In the example below I have a record array *a* that has a column > *col1". I am trying to set the first element of a.col1 to zero in two > different ways. > > 1. a[0].col1 = 0 (This fails silently) > 2. a.col1[0] = 0 (This works fin

Re: [Numpy-discussion] Error in allclose with inf values

2007-08-20 Thread Stefan van der Walt
Hi Matthew On Fri, Aug 17, 2007 at 01:11:41PM +0100, Matthew Brett wrote: > I noticed that allclose does not always behave correctly for arrays with infs. > > I've attached a test script for allclose, and here's an alternative > implementation that I believe behaves correctly. Thanks for the pat

Re: [Numpy-discussion] fast putmask implementation

2007-08-20 Thread Stefan van der Walt
On Sat, Aug 18, 2007 at 01:51:50AM -0600, Travis Oliphant wrote: > > Not any more! See the revised PEP 007, > > http://www.python.org/dev/peps/pep-0007/ > > > > In Python 3000 (and in the 2.x series, in new source files), > > we'll switch to a different indentation style: 4 spaces per i

[Numpy-discussion] Setting numpy record array elements

2007-08-20 Thread Sameer DCosta
Hi, In the example below I have a record array *a* that has a column *col1". I am trying to set the first element of a.col1 to zero in two different ways. 1. a[0].col1 = 0 (This fails silently) 2. a.col1[0] = 0 (This works fine) I am using the latest svn version of numpy. Is this a bug? or is t

Re: [Numpy-discussion] selecting part of an array like a[ a<5 ]

2007-08-20 Thread Keith Goodman
On 8/20/07, mark <[EMAIL PROTECTED]> wrote: > b = a>5 > > a[not b] or a[!b] don't work. So it's gotta be something different. a[~b] ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] selecting part of an array like a[ a<5 ]

2007-08-20 Thread mark
Hello - I am wondering what the better way is to select part of an array. Say I have an array a: a = arange(10) Now I want to select the values larger than 5 a[ a>5 ] and later I need the values smaller or equal to 5 a[ a<=5 ] It seems that doing the comparison twice is extra work (especiall