Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Alan G Isaac
On Wed, 21 Jun 2006, Bill Baxter apparently wrote: ew to numpy.nonzero I agree that having the method and function behave so differently is awkward; this was discussed before on this list. It does allow Simon's nicer solution, however. I'm not sure why bool arrays cannot be used as

[Numpy-discussion] LittleEndian

2006-06-21 Thread Johnston Sheldon
Hi, Can someone give a brief example of the Numeric function LittleEndian? I have written two separate functions to read binary data that can be either LittleEndian or BigEndian (using byteswapped() ) but it would be great with just one function. Much obliged, Sheldon

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Johannes Loehnert
Hi, I'm not sure why bool arrays cannot be used as indices. The natural solution to the original problem seemed to be: M[:,V0] but this is not allowed. I started a thread on this earlier this year. Try searching the archive for boolean indexing (if it comes back online somewhen). Travis

Re: [Numpy-discussion] LittleEndian

2006-06-21 Thread Albert Strasheim
Hey Sheldon With NumPy you can use dtype's newbyteorder method to convert any dtype's byte order to an order you specify: In [1]: import numpy as N In [2]: x = N.array([1],dtype='i4') In [3]: y = N.array([1],dtype='i4') In [4]: xle = N.asarray(x, dtype=x.dtype.newbyteorder('')) In [5]: yle =

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Keith Goodman
On 6/20/06, Bill Baxter [EMAIL PROTECTED] wrote: a[:,num.where(v0.5)[0]] array([[1, 2, 4], [6, 7, 9]]) I'll put that up on the Matlab-Numpy page. That's a great addition to the Matlab to Numpy page. But it only works if v is a column vector. If v is a row vector, then where(v.A

[Numpy-discussion] SciPy 2006 Tutorials

2006-06-21 Thread Travis N. Vaught
All, As part of this year's SciPy 2006 Conference, we've planned Coding Sprints on Monday and Tuesday (August 14-15) and a Tutorial Day Wednesday (August 16)--the normal conference presentations follow on Thursday and Friday (August 17-18). For this year at least, the Tutorials (and Sprints)

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Travis Oliphant
Bill Baxter wrote: On 6/21/06, *Simon Burton* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Wed, 21 Jun 2006 13:48:48 +0900 Bill Baxter [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: a[:,num.where(v0.5)[0]] array([[1, 2, 4], [6, 7, 9]])

[Numpy-discussion] Bug with cumsum(dtype='f8')?

2006-06-21 Thread Craig Loomis
Not sure if this one has been addressed. There appears to be a problem with cumsum(dtype=), with reasonably small numbers. Both PPC and x86 Macs. import numpy print numpy version:, numpy.__version__ v = numpy.arange(10002) # 10001 is OK, larger is worse print

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Pau Gargallo
On 6/21/06, Travis Oliphant [EMAIL PROTECTED] wrote: Johannes Loehnert wrote: Hi, I'm not sure why bool arrays cannot be used as indices. The natural solution to the original problem seemed to be: M[:,V0] but this is not allowed. I started a thread on this earlier this year.

[Numpy-discussion] Element-by-element matrix multiplication

2006-06-21 Thread Keith Goodman
The NumPy for Matlab Users page suggests mat(a.A * b.A) for element-by-element matrix multiplication. I think it would be helpful to also include multiply(a, b). a.*b mat(a.A * b.A) or multiply(a, b) ___ Numpy-discussion mailing list

Re: [Numpy-discussion] Element-by-element matrix multiplication

2006-06-21 Thread Robert Kern
Keith Goodman wrote: The NumPy for Matlab Users page suggests mat(a.A * b.A) for element-by-element matrix multiplication. I think it would be helpful to also include multiply(a, b). a.*b mat(a.A * b.A) or multiply(a, b) It is a wiki page. You may edit it yourself without needing to ask

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Travis Oliphant
Pau Gargallo wrote: On 6/21/06, Travis Oliphant [EMAIL PROTECTED] wrote: Johannes Loehnert wrote: Hi, I'm not sure why bool arrays cannot be used as indices. The natural solution to the original problem seemed to be: M[:,V0] but this is not allowed. I started

[Numpy-discussion] Problem installing numpy on Gentoo

2006-06-21 Thread Webb Sprague
I am trying to install numpy on Gentoo (see my info below for version etc). It all seems to go fine, but when I try to import it and run the tests, I get the following error (in ipython): In [1]: import numpy import linalg - failed: libg2c.so.0: cannot open shared object file: No such file or

Re: [Numpy-discussion] Element-by-element matrix multiplication

2006-06-21 Thread Keith Goodman
On 6/21/06, Robert Kern [EMAIL PROTECTED] wrote: Keith Goodman wrote: The NumPy for Matlab Users page suggests mat(a.A * b.A) for element-by-element matrix multiplication. I think it would be helpful to also include multiply(a, b). a.*b mat(a.A * b.A) or multiply(a, b) It is a

Re: [Numpy-discussion] memory leak in array

2006-06-21 Thread Travis Oliphant
[EMAIL PROTECTED] wrote: Hi Travis Not sure if you've had a chance to look at the previous code I sent or not, but I was able to reduce the code (see below) to its smallest size and still have the problem, albeit at a slower rate. The problem appears to come from changing values in the

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Alan G Isaac
Alan G Isaac wrote: M.transpose()[V0] If you want the columns as columns, you can transpose again. On Wed, 21 Jun 2006, Keith Goodman apparently wrote: I can't get that to work when M is a n by m matrix: The problem is not M being a matrix. You made V a matrix (i.e., 2d). So you need

[Numpy-discussion] flatiter and inequality comparison

2006-06-21 Thread Alan G Isaac
I do not understand how to think about this: x=arange(3).flat x numpy.flatiter object at 0x01BD0C58 x2 True x10 True Why? (I realize this behaves like xrange, so this may not be a numpy question, but I do not understand that behavior either.) What I expected:

Re: [Numpy-discussion] MA bug or feature?

2006-06-21 Thread Michael Sorich
I was setting the fill_value as 'NA' when constructing the array so the masked values would be printed as 'NA'. It is not a big deal to avoid doing this. Nevertheless, the differences between a masked array with a boolean mask and a mask of booleans have caused me trouble before. Especially when

[Numpy-discussion] f.p. powers and masked arrays

2006-06-21 Thread Michael Fitzgerald
Hello all, I'm encountering some (relatively new?) behavior with masked arrays that strikes me as bizarre. Raising zero to a floating-point value is triggering a mask to be set, even though the result should be well-defined. When using fixed-point integers for powers, everything works as

Re: [Numpy-discussion] Selecting columns of a matrix

2006-06-21 Thread Travis Oliphant
Simon Burton wrote: On Wed, 21 Jun 2006 10:50:26 -0600 Travis Oliphant [EMAIL PROTECTED] wrote: So, in SVN NumPy, you will be able to do a[:,V0] a[V0,:] The V0 will be replaced with integer arrays as if nonzero(V0) had been called. OK. But just for the record, we should