Re: [Numpy-discussion] The risks of empty()

2007-01-02 Thread A. M. Archibald
On 02/01/07, Bock, Oliver BGI SYD <[EMAIL PROTECTED]> wrote: > Some of my arrays are not fully populated. (I separately record which > entries are valid.) I want to use numpy.empty() to speed up the > creation of these arrays, but I'm worried about what will happen if I > apply operations to the

Re: [Numpy-discussion] The risks of empty()

2007-01-02 Thread Tim Hochberg
Bock, Oliver BGI SYD wrote: > Some of my arrays are not fully populated. (I separately record which > entries are valid.) I want to use numpy.empty() to speed up the > creation of these arrays, but I'm worried about what will happen if I > apply operations to the entire contents of these arrays.

Re: [Numpy-discussion] The risks of empty()

2007-01-02 Thread Robert Kern
Bock, Oliver BGI SYD wrote: > Some of my arrays are not fully populated. (I separately record which > entries are valid.) I want to use numpy.empty() to speed up the > creation of these arrays, but I'm worried about what will happen if I > apply operations to the entire contents of these arrays.

[Numpy-discussion] The risks of empty()

2007-01-02 Thread Bock, Oliver BGI SYD
Some of my arrays are not fully populated. (I separately record which entries are valid.) I want to use numpy.empty() to speed up the creation of these arrays, but I'm worried about what will happen if I apply operations to the entire contents of these arrays. E.g. a + b I care about the resul

[Numpy-discussion] ANN: MaskedArray as a subclass of ndarray - followup

2007-01-02 Thread Pierre GM
All, I've updated this famous reimplementation of maskedarray I keep ranting about. A new feature has been introduced : hard_mask. When a masked array is created with the flag hard_mask=True, the mask can only grow, not shrink. In other terms, masked values cannot be unmasked. The flag hard_mask is

Re: [Numpy-discussion] argmax()

2007-01-02 Thread Alan G Isaac
On Mon, 1 Jan 2007, Niklas Saers apparently wrote: > If it makes any sense I'd love to send you this variable > that had len(2048) but was very much longer if stomped > flat. :-) It looks like you may already understand this, but just in case... import numpy r = numpy.random.random((100,5)) m

Re: [Numpy-discussion] Scalar values with a matrix

2007-01-02 Thread Sven Schreiber
Charles R Harris schrieb: > > mat(5) is a 1x1 matrix: > > In [5]: mat(5) > Out[5]: matrix([[5]]) > > so the error is valid. If you want to do a scalar multiply try > > In [6]: amat*5 > Out[6]: > matrix([[ 0, 5, 10, 15], > [20, 25, 30, 35], > [40, 45, 50, 55]]) Or you can do m

Re: [Numpy-discussion] subclassing recarray

2007-01-02 Thread Stefan van der Walt
Hi Matthew On Tue, Jan 02, 2007 at 02:30:34AM -0500, Matthew Koichi Grimes wrote: > Is it hard to subclass recarrays? I'm currently working on a subclass > that doesn't add much; just some methods that sets all the values to > zero and other similarly trivial things. It'd be nice to make it wor