Re: [Numpy-discussion] reference count problems

2006-11-15 Thread Stefan van der Walt
On Wed, Nov 15, 2006 at 02:33:52PM -0600, Robert Kern wrote: > Mathew Yeates wrote: > > Hi > > I'm running a 64 bit Python 2.5 on an x86 with Solaris. I have a > > function I call over 2^32 times and eventually I run out of memory. > > > > The function is > > def make_B(deltadates): > > numco

Re: [Numpy-discussion] array from list of lists

2006-11-13 Thread Stefan van der Walt
On Mon, Nov 13, 2006 at 02:29:11PM -0700, Tim Hochberg wrote: > Erin Sheldon wrote: > > On 11/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > > > >> Here's one more approach that's marginally faster than the map based > >> solution and also won't chew up an extra memory since it's based on from

Re: [Numpy-discussion] Assign NaN, get zero

2006-11-11 Thread Stefan van der Walt
On Sat, Nov 11, 2006 at 01:59:40PM -0800, Keith Goodman wrote: > Would it make sense to upcast instead of downcast? > > This upcasts: > > >> x = M.matrix([[1, M.nan, 3]]) > >> x > matrix([[ 1., nan, 3.]]) > > But this doesn't: > > >> x = M.matrix([[1, 2, 3]]) > >> x[0,1

Re: [Numpy-discussion] Assign NaN, get zero

2006-11-11 Thread Stefan van der Walt
On Sat, Nov 11, 2006 at 06:30:06PM -0300, Lisandro Dalcin wrote: > On 11/11/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > NaN (or inf) is a floating point number, so seeing a zero in integer > > representation seems correct: > > > > In [2]: int(N.nan) >

Re: [Numpy-discussion] Assign NaN, get zero

2006-11-11 Thread Stefan van der Walt
On Sat, Nov 11, 2006 at 10:40:22AM -0800, Keith Goodman wrote: > I accidentally wrote a unit test using int32 instead of float64 and > ran into this problem: > > >> x = M.matrix([[1, 2, 3]]) > >> x[0,1] = M.nan > >> x > matrix([[1, 0, 3]]) <--- Got 0 instead of NaN > > But this, of course, work

Re: [Numpy-discussion] Grief with a complex value

2006-11-09 Thread Stefan van der Walt
On Thu, Nov 09, 2006 at 03:18:57AM -0500, Colin J. Williams wrote: > > >>> import numpy.core as _n > >>> _nt= _n.numerictypes > >>> value= > '[EMAIL PROTECTED]@[EMAIL PROTECTED]@\x00\x00\x00\x00\x00\x00\x18@' > >>> _n.array(value, dtype= _nt.complex128, copy=True) > Traceback (most recent cal

Re: [Numpy-discussion] Profiling Python codes with hotshot and KCachegrind

2006-11-08 Thread Stefan van der Walt
On Wed, Nov 08, 2006 at 01:32:44AM -0700, Fernando Perez wrote: > Hi all, > > in the past, Arnd Baecker has made a number of very useful posts on > this matter, and provided some nice utilities to do it. I now needed > to profile some fairly complex codes prior to a big optimization push, > so I

Re: [Numpy-discussion] matrix multiplication (newbie question)

2006-11-08 Thread Stefan van der Walt
On Wed, Nov 08, 2006 at 05:54:17AM -0800, izak marais wrote: > Hi > > Sorry if this is an obvious question, but what is the easiest way to multiply > matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently > does element wise multiplication, as does the 'multiply' ufunc. All

Re: [Numpy-discussion] Style - was Re: numpy.repeat TypeError: array cannot be safely cast to required type

2006-11-06 Thread Stefan van der Walt
On Mon, Nov 06, 2006 at 03:10:20PM -0500, Colin J. Williams wrote: > Many thanks. In general, there is sense in the Python dictum about having one > way to do things. Although, in this case [length] vs length for one dimension > doesn't > exercise me greatly. I would be a bit more concerned abou

Re: [Numpy-discussion] ctypes warning

2006-11-06 Thread Stefan van der Walt
On Mon, Nov 06, 2006 at 02:09:32PM -0600, John Hunter wrote: > > A simple import of numpy with the latest svn triggers a ctypes warning > > In [1]: import numpy > /usr/lib/python2.4/site-packages/numpy/ctypeslib.py:12: UserWarning: > All features of ctypes interface may not work with ctypes < 1.0

Re: [Numpy-discussion] Release of 1.0 coming

2006-10-23 Thread Stefan van der Walt
On Mon, Oct 23, 2006 at 05:28:05PM -0600, Travis Oliphant wrote: > Yes it has. Fixed. > > I think ctypes 1.0.1 is required for ndpointer to work, so we might consider > > some kind of version check + warning on import? > > > Not sure about that. It worked for me using ctypes 1.0.0. You have

Re: [Numpy-discussion] ix_ problem changing input arrays?

2006-10-23 Thread Stefan van der Walt
On Mon, Oct 23, 2006 at 11:57:57AM -0400, Scott Ransom wrote: > I believe that ix_() has recently begun modifying the shapes of its > input arrays. For instance: [...] This should be fixed in SVN. Cheers Stéfan - Using To

Re: [Numpy-discussion] some work on arpack

2006-10-22 Thread Stefan van der Walt
On Sun, Oct 22, 2006 at 09:27:39AM +0900, Bill Baxter wrote: > On 10/22/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > On 10/21/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > > Here's something I've been wondering: is it ok to port Matlab > > > functions over to python? If so, then it's maybe

Re: [Numpy-discussion] Numpy-scalars vs Numpy 0-d arrays: copy or not copy?

2006-10-20 Thread Stefan van der Walt
On Fri, Oct 20, 2006 at 11:42:26AM +0200, Sebastien Bardeau wrote: > >>> a = numpy.array((1,2,3)) > >>> b = a[:2] Here you index by a slice. > >>> c = a[2] Whereas here you index by a scalar. So you want to do b = a[[2]] b += 1 or in the general case b = a[slice(2,3)] b += 1 Regards Stéf

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-20 Thread Stefan van der Walt
On Thu, Oct 19, 2006 at 09:03:57PM -0400, Pierre GM wrote: > Indeed. That's basically why you have to edit your __array_finalize__ . > > class InfoArray(N.ndarray): > def __new__(info_arr_cls,arr,info={}): > info_arr_cls._info = info > return N.array(arr).view(info_arr_cls) >

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-19 Thread Stefan van der Walt
On Thu, Oct 19, 2006 at 09:45:02AM -0600, Travis Oliphant wrote: > Stefan van der Walt wrote: > > >If I understand correctly, the following should work: > > > >import numpy as N > > > >class InfoArray(N.ndarray): > >def __new__(info_arr_cls,arr,inf

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-19 Thread Stefan van der Walt
On Thu, Oct 19, 2006 at 01:59:49PM -0700, Christopher Barker wrote: > Travis Oliphant wrote: > > Actually something as simple as > > > > class InfoArray(N.ndarray): > > pass > > > > will allow you to add attributes to InfoArray. > > Well, sure, but how the heck do you initialize it? Lo

Re: [Numpy-discussion] adding an attribute to an nd-array

2006-10-19 Thread Stefan van der Walt
On Wed, Oct 18, 2006 at 09:17:49PM -0400, Pierre GM wrote: > On Wednesday 18 October 2006 20:29, Stefan van der Walt wrote: > > A quick question on extending numpy arrays: is it possible to easily > > add an attribute to an ndarray? > > It might be easier to create a subcla

[Numpy-discussion] adding an attribute to an nd-array

2006-10-18 Thread Stefan van der Walt
A quick question on extending numpy arrays: is it possible to easily add an attribute to an ndarray? With Python-defined classes one can do class X(object): pass x = X() x.foo = 'bar' but with ndarrays you get x = N.array([1,2,3]) x.foo = 'bar' AttributeError: 'numpy.ndarray' object has n

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Stefan van der Walt
On Tue, Oct 17, 2006 at 07:53:11PM -0600, Travis Oliphant wrote: > Stefan van der Walt wrote: > > Hi all, > > > > Some of you may have seen the interesting thread on Fortran-ordering > > earlier. I thought it might be fun to set up a short quiz which tests >

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Stefan van der Walt
On Wed, Oct 18, 2006 at 10:30:26AM +0900, Bill Baxter wrote: > I think the answer to #3 is wrong. > > >From 1.0rc2 I get: > >>> array([1,2,3,4,5,6],order='C').reshape((2,3),order='F') > array([[1, 2, 3], >[4, 5, 6]]) > > But the quiz wants me to answer something different. This recently

[Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Stefan van der Walt
Hi all, Some of you may have seen the interesting thread on Fortran-ordering earlier. I thought it might be fun to set up a short quiz which tests your knowledge on the topic. If you're up for the challenge, take a look at http://mentat.za.net/numpy/quiz I won't be held liable for any emotiona

Re: [Numpy-discussion] What does Fortran order mean?

2006-10-17 Thread Stefan van der Walt
On Tue, Oct 17, 2006 at 10:01:51AM -0600, Travis Oliphant wrote: > Charles R Harris wrote: > > > Travis, > > > > I note that > > > > >>> a = arange(6).reshape(2,3,order='F') > > >>> a > > array([[0, 1, 2], > >[3, 4, 5]]) > > > > Shouldn't that be 3x2? Or maybe [[0,2,4],[1,3,5]]? Reshape is

Re: [Numpy-discussion] What does Fortran order mean?

2006-10-17 Thread Stefan van der Walt
On Mon, Oct 16, 2006 at 02:20:04PM -0600, Charles R Harris wrote: > Travis, > > I note that > > >>> a = arange(6).reshape(2,3,order='F') > >>> a > array([[0, 1, 2], >[3, 4, 5]]) > > Shouldn't that be 3x2? Or maybe [[0,2,4],[1,3,5]]? Reshape is making a copy, > but flat, flatten, and tost

Re: [Numpy-discussion] Testing numpy without doing an installation?

2006-10-17 Thread Stefan van der Walt
On Tue, Oct 17, 2006 at 10:03:03AM +0200, Francesc Altet wrote: > A Divendres 13 Octubre 2006 22:20, Lisandro Dalcin va escriure: > > On 10/13/06, Francesc Altet <[EMAIL PROTECTED]> wrote: > > > Is it possible to test a numpy version directly from the source > > > directory without having to instal

[Numpy-discussion] dtype always copies

2006-10-13 Thread Stefan van der Walt
Hi all, I've noticed that 'astype' always forces a copy. Is this behaviour intended? It seems to conflict with 'asarray', that tries to avoid a copy. For example, when wrapping code in ctypes, the following snippet would have been useful: def foo(x): # ensure x is an array of the right typ

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than?nan?

2006-10-12 Thread Stefan van der Walt
On Thu, Oct 12, 2006 at 10:53:12AM -0400, Alan G Isaac wrote: > On Thu, 12 Oct 2006, Stefan van der Walt apparently wrote: > > I tried to explain the argument at > > http://www.scipy.org/NegativeSquareRoot > > Helpful. But you start off by saying: > I

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Stefan van der Walt
On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: > On 10/11/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: > > Speed should not take precedence over correctness. > > Unless your goal is speed. Then speed should take pr

Re: [Numpy-discussion] Please test the SVN branch

2006-10-12 Thread Stefan van der Walt
On Thu, Oct 12, 2006 at 12:38:51AM -0600, Travis Oliphant wrote: > > I made some fixes to the "asbuffer" code which let me feel better about > exposing it in NumPy (where it is now named int_asbuffer). > > This code takes a Python integer and a size and returns a buffer object > that points to

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-12 Thread Stefan van der Walt
I've summarised this thread at http://www.scipy.org/NegativeSquareRoot Feel free to make adjustments, in case I missed something. Regards Stefan - Using Tomcat but need to do more? Need to support web services, security? Ge

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Stefan van der Walt
On Wed, Oct 11, 2006 at 08:24:01PM -0400, A. M. Archibald wrote: > What is the desired behaviour of sqrt? [...] > Should it return a complex array only when any entry in its input is > negative? This will be even *more* surprising when a negative (perhaps > even -0) value appears in their matrix

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Stefan van der Walt
On Wed, Oct 11, 2006 at 05:21:44PM -0600, Travis Oliphant wrote: > Stefan van der Walt wrote: > > >I agree with Fernando on this one. > > > >Further, if I understand correctly, changing sqrt and power to give > >the right answer by default will slow things down

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Stefan van der Walt
On Wed, Oct 11, 2006 at 03:37:34PM -0600, Fernando Perez wrote: > On 10/11/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > >Could sqrt(-1) made to return 1j again? > > > > > Not in NumPy. But, in scipy it could. > > Without taking sides on which way to go, I'd l

Re: [Numpy-discussion] "Manually" broadcasting arrays in Python

2006-10-06 Thread Stefan van der Walt
On Wed, Oct 04, 2006 at 01:37:55AM -0400, A. M. Archibald wrote: > Would it be useful for me to contribute the tiny script I wrote to > trigger it as a regression test? > > A. M. Archibald > > from numpy import vectorize, zeros > > vt = vectorize(lambda *args: args) > # Removing either of the fo

Re: [Numpy-discussion] repmat

2006-10-06 Thread Stefan van der Walt
On Fri, Oct 06, 2006 at 10:30:43AM +0900, Bill Baxter wrote: > If this is somehow controversial for some reason then let's discuss > it. But so far the only response has been "copying data is a bad > idea", which is really a separate issue. An interesting issue, though. I've often wondered about

[Numpy-discussion] return value of negative power

2006-09-28 Thread Stefan van der Walt
Hi all, Currently, the power function returns '0' for negative powers of integers: In [1]: N.power(3,-2) Out[1]: 0 (or, more confusingly) In [1]: N.power(a,b) Out[1]: 0 which is almost certainly not the answer you want. Two possible solutions may be to upcast the input to float before calcula

Re: [Numpy-discussion] Putmask/take ?

2006-09-22 Thread Stefan van der Walt
On Fri, Sep 22, 2006 at 02:17:57AM -0500, Robert Kern wrote: > Stefan van der Walt wrote: > > Hi P., > > > > On Thu, Sep 21, 2006 at 07:40:39PM -0400, PGM wrote: > > > >> I'm running into the following problem with putmask on take. > >> > &

Re: [Numpy-discussion] putmask/take ?

2006-09-22 Thread Stefan van der Walt
On Thu, Sep 21, 2006 at 08:35:02PM -0400, P GM wrote: > Folks, > I'm running into the following problem with putmask on take. > > >>> import numpy > >>> x = N.arange(12.) > >>> m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1] > >>> i = N.nonzero (m)[0] > >>> w = N.array([-1, -2, -3, -4.]) > >>> x.putmask(

Re: [Numpy-discussion] Putmask/take ?

2006-09-22 Thread Stefan van der Walt
Hi P., On Thu, Sep 21, 2006 at 07:40:39PM -0400, PGM wrote: > I'm running into the following problem with putmask on take. > > >>> import numpy > >>> x = N.arange(12.) > >>> m = [1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1] > >>> i = N.nonzero(m)[0] > >>> w = N.array([-1, -2, -3, -4.]) > >>> x.putmask(w,

[Numpy-discussion] unique1d: renaming retindx to return_index

2006-09-18 Thread Stefan van der Walt
Hi, Would anyone object if I changed the signature of unique1d(ar1, retindx=False) to unique1d(ar1, return_index=False)? I find retindx both harder to read and to type than return_index. Thanks. Stéfan - Take Surveys. Ea

Re: [Numpy-discussion] fftfreq very slow; rfftfreq incorrect?

2006-08-30 Thread Stefan van der Walt
On Wed, Aug 30, 2006 at 12:04:22PM +0100, Andrew Jaffe wrote: > the current implementation of fftfreq (which is meant to return the > appropriate frequencies for an FFT) does the following: > > k = range(0,(n-1)/2+1)+range(-(n/2),0) > return array(k,'d')/(n*d) > > I have tried this wit

Re: [Numpy-discussion] stumped numpy user seeks help

2006-08-30 Thread Stefan van der Walt
On Tue, Aug 29, 2006 at 03:46:45PM -0700, Mathew Yeates wrote: > My head is about to explode. > > I have an M by N array of floats. Associated with the columns are > character labels > ['a','b','b','c','d','e','e','e'] note: already sorted so duplicates > are contiguous > > I want to replace t

Re: [Numpy-discussion] possible bug with numpy.object_

2006-08-30 Thread Stefan van der Walt
On Tue, Aug 29, 2006 at 10:49:58AM -0600, Travis Oliphant wrote: > Matt Knox wrote: > > is the following behaviour expected? or is this a bug with > > numpy.object_ ? I'm using numpy 1.0b1 > > > > >>> print numpy.array([],numpy.float64).size > > 0 > > > > >>> print numpy.array([],numpy.object_

Re: [Numpy-discussion] users point of view and ufuncs

2006-08-25 Thread Stefan van der Walt
On Thu, Aug 24, 2006 at 11:10:24PM -0400, Sasha wrote: > I would welcome an effort to make the glossary more novice friendly, > but not at the expense of oversimplifying things. > > BTW, do you think "Rank ... (2) number of orthogonal dimensions of a > matrix" is clear? Considering that matrix is

Re: [Numpy-discussion] bugfix-patch for numpy-1.0b2 setup

2006-08-18 Thread Stefan van der Walt
On Fri, Aug 18, 2006 at 04:45:03PM +0200, Stefan van der Walt wrote: > Hi Norbert > > On Fri, Aug 18, 2006 at 03:36:47PM +0200, Norbert Nemec wrote: > > in numpy-1.0b2 the logic in setup.py is slightly off. The attached patch > > fixes the issue. > > Please file a t

Re: [Numpy-discussion] bugfix-patch for numpy-1.0b2 setup

2006-08-18 Thread Stefan van der Walt
Hi Norbert On Fri, Aug 18, 2006 at 03:36:47PM +0200, Norbert Nemec wrote: > in numpy-1.0b2 the logic in setup.py is slightly off. The attached patch > fixes the issue. Please file a ticket so that we don't lose track of this. Stéfan --

Re: [Numpy-discussion] ctypes: how does load_library work ?

2006-08-18 Thread Stefan van der Walt
On Fri, Aug 18, 2006 at 01:54:44PM +0900, David Cournapeau wrote: > import numpy as N > from ctypes import cdll, POINTER, c_int, c_uint > > _hello = cdll.LoadLibrary('libhello.so') > > _hello.sum.restype= c_int > _hello.sum.artype = [POINTER(c_int), c_uint] > > def sum(data): > retur

Re: [Numpy-discussion] Fastest binary threshold?

2006-08-03 Thread Stefan van der Walt
Hi Mark On Thu, Aug 03, 2006 at 11:25:26AM -0400, Mark Heslep wrote: > Stefan van der Walt wrote: > > Binary thresholding can be added to ndimage easily, if further speed > > improvement is needed. > > > > Regards > > Stéfan > Yes Id like to become involved

Re: [Numpy-discussion] Fastest binary threshold?

2006-08-02 Thread Stefan van der Walt
On Wed, Aug 02, 2006 at 04:51:07PM -0400, Mark Heslep wrote: > I need a binary threshold and numpy.where() seems very slow on numpy > 0.9.9.2800: > > python -m timeit -n 10 -s "import numpy as n;a=n.ones((512,512), > n.uint8)*129" > "a_bin=n.where( a>128, 128,0)" > 10 loops, best of 3: 37.9 ms

Re: [Numpy-discussion] Handling of backward compatibility

2006-08-02 Thread Stefan van der Walt
On Tue, Aug 01, 2006 at 06:21:49PM -0600, Travis Oliphant wrote: > I'm wondering about whether or not some additional effort should be > placed in numpy.oldnumeric so that replacing Numeric with > numpy.oldnumeric actually gives no compatibility issues (i.e. the only > thing you have to change i

Re: [Numpy-discussion] uniform() regression(?) in svn

2006-07-31 Thread Stefan van der Walt
Hi Darren On Fri, Jul 28, 2006 at 02:33:17PM -0400, Darren Dale wrote: > I dont know if this is related or not, but I just did an update from the > trunk > ('1.0b2.dev2918') and discovered the following error: > > == > FAIL: Ti

[Numpy-discussion] Moving docstrings from C to Python

2006-07-28 Thread Stefan van der Walt
Hi, Travis recently advertised the add_docstring and add_newdoc functions, which are used to add documentation to functions written in C. This brings the advantage that you don't have to recompile everytime you change a docstrings, and also that the docstrings are much simpler to format (no more

Re: [Numpy-discussion] Pretty printing an array: no ellipses?

2006-07-20 Thread Stefan van der Walt
On Wed, Jul 19, 2006 at 03:06:00PM -0700, Webb Sprague wrote: > I am not sure where to look for this, sorry if it is RTFM or JPS > ("just plain stupid"): > > Is there a way to set a default to print the entire array, rather than > an ellipses version of it? If not, why doesn't > pprint.pformat(nu

Re: [Numpy-discussion] "ImportError: No module named numeric"

2006-07-12 Thread Stefan van der Walt
Hi Tamaryn On Wed, Jul 12, 2006 at 11:57:48AM +0100, Tamaryn Menneer wrote: > Hi > > I'm running Python 2.4 on Windows XP. I've installed NumPy, and run the > simple test of "import numeric" but I get the error "ImportError: No module > named numeric" in return. The module numeric is located in

Re: [Numpy-discussion] Args for rand and randn, and workarounds

2006-07-12 Thread Stefan van der Walt
On Wed, Jul 12, 2006 at 05:47:15PM +0900, Bill Baxter wrote: > On 7/12/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > > Because of this. I've removed the global_namespace functions (fft, > ifft, rand, and randn) from numpy. They are *no longer* in the > top-level name-space. I

Re: [Numpy-discussion] how to use argsort result?

2006-07-11 Thread Stefan van der Walt
On Tue, Jul 11, 2006 at 12:37:23PM +0200, Pau Gargallo wrote: > > Something's not quite right here. The argsort docstring states that: > > > > argsort(a,axis=-1) return the indices into a of the sorted array > > along the given axis, so that take(a,result,axis) is the sorted array. > > > >

Re: [Numpy-discussion] how to use argsort result?

2006-07-11 Thread Stefan van der Walt
On Tue, Jul 11, 2006 at 11:32:48AM +0200, Emanuele Olivetti wrote: > Hi, > I don't understand how to use argsort results. I have a 2D matrix and > I want to sort values in each row and obtain the index array of that > sorting. Argsort(1) is what I need, but the problem is how to use its > result in

Re: [Numpy-discussion] NumPy C-API now has prefixes

2006-07-07 Thread Stefan van der Walt
On Fri, Jul 07, 2006 at 07:06:58PM -0600, Fernando Perez wrote: > On 7/7/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > I just committed a big change to the NumPy SVN (r2773-r2777) which adds > > the prefix npy_ or NPY_ to all names not otherwise pre-fixed. > > > > There is also a noprefix.h h

Re: [Numpy-discussion] Call for a vote on .M .A .T .H attributes

2006-07-07 Thread Stefan van der Walt
On Thu, Jul 06, 2006 at 10:26:12PM -0600, Travis Oliphant wrote: > 1) .T Have some kind of .T attribute -1, since the expected behaviour of .T is different depending on problem context. >a) .T == .swapaxes(-2,-1) The fact that this was proposed just demonstrates the fact. If you have a (10

Re: [Numpy-discussion] Determining if two arrays share data

2006-07-06 Thread Stefan van der Walt
On Thu, Jul 06, 2006 at 11:39:19AM +0900, Bill Baxter wrote: > Often when I'm doing interactive prototyping I find myself wanting to check > whether two arrays are sharing a copy of the same data. > > It seems like there ought to be a concise way to do that, but right now seems > like the only way

Re: [Numpy-discussion] Combining arrays together

2006-07-03 Thread Stefan van der Walt
On Mon, Jul 03, 2006 at 11:16:26AM +0900, Bill Baxter wrote: > What's the best way to combine say several 2-d arrays together into a grid? > Here's the best I can see: > > >>> a = eye(2,2) > >>> b = 2*a > >>> c = 3*a > >>> d = 4*a > >>> r_[c_[a,b],c_[c,d]] > array([[1, 0, 2, 0], >[0, 1, 0,

Re: [Numpy-discussion] Bug in digitize function

2006-06-30 Thread Stefan van der Walt
Hi David On Thu, Jun 29, 2006 at 02:42:51PM -0400, David Huard wrote: > Here is something I noticed with digitize() that I guess would qualify as a > small but annoying bug. > > In [165]: x = rand(10); bin = linspace(x.min(), x.max(), 10); print x.min(); > print bin[0]; digitize(x,bin) > 0.092503

[Numpy-discussion] matlab -> python translation

2006-06-28 Thread Stefan van der Walt
CTED]> - From: "John W. Eaton" <[EMAIL PROTECTED]> On 21-Jun-2006, Stefan van der Walt wrote: | I'd like to bring this thread under your attention, in case you want | to comment: | | http://aspn.activestate.com/ASPN/Mail/Message/numpy-discussion/3174978 Would yo

Re: [Numpy-discussion] Upgrading from numpy 0.9.7.2416 to 0.9.9.2683

2006-06-27 Thread Stefan van der Walt
On Tue, Jun 27, 2006 at 09:45:57AM -0700, Keith Goodman wrote: > This works in numpy 0.9.7.2416 but doesn't work in numpy 0.9.9.2683: > > Numpy 0.9.9.2683 > > x = asmatrix(zeros((3,2), float)) > y = asmatrix(rand(3,1)) > y > > matrix([[ 0.49865026], >[ 0.82675808], >[ 0.30285247]

[Numpy-discussion] sourceforge advertising

2006-06-22 Thread Stefan van der Walt
Hi, I noticed that sourceforge now adds another 8 lines of advertisement to the bottom of every email sent to the list. Am I the only one who finds this annoying? Is there any reason why the numpy list can't run on scipy.org? Regards Stéfan Using Tomcat but need to do more? Need to support web

Re: [Numpy-discussion] Numexpr does broadcasting.

2006-06-22 Thread Stefan van der Walt
Hi Tim On Wed, Jun 21, 2006 at 12:02:27PM -0700, Tim Hochberg wrote: > > Numexpr can now handle broadcasting. As an example, check out this > implementation of the distance-in-a-bunch-of-dimenstions function that's > been going around. This is 80% faster than the most recent one posted on > my

Re: [Numpy-discussion] what happened to numarray type names ?

2006-06-20 Thread Stefan van der Walt
Hi Simon On Tue, Jun 20, 2006 at 08:22:30PM +0100, Simon Burton wrote: > > >>> import numpy > >>> numpy.__version__ > '0.9.9.2631' > >>> numpy.Int32 > Traceback (most recent call last): > File "", line 1, in ? > AttributeError: 'module' object has no attribute 'Int32' > >>> > > This was workin

Re: [Numpy-discussion] array of tuples

2006-06-06 Thread Stefan van der Walt
On Tue, Jun 06, 2006 at 01:05:43PM -0500, Travis N. Vaught wrote: > looping). Is there a quick way to do this with dtype? > > I've tried: > > >>> import numpy > >>> x = [(1,2,3),(4,5,6)] > >>> numpy.array(x) > array([[1, 2, 3], >[4, 5, 6]]) > >>> numpy.array(x, dtype='p') > array([[1

Re: [Numpy-discussion] numpy.test(1,10) results in a segfault

2006-05-31 Thread Stefan van der Walt
I filed this as ticket #135: http://projects.scipy.org/scipy/numpy/ticket/135 Regards Stéfan On Wed, May 31, 2006 at 05:47:25PM +0200, Nils Wagner wrote: > test_wrap (numpy.core.tests.test_umath.test_special_methods) ... ok > check_types (numpy.core.tests.test_scalarmath.test_types)*** glibc > d