Re: [Numpy-discussion] strict aliasing?

2008-05-04 Thread Charles R Harris
On Sun, May 4, 2008 at 11:16 PM, David Cournapeau < [EMAIL PROTECTED]> wrote: > Charles R Harris wrote: > > > > > As far as I can tell, strict aliasing assumes that pointers are only > > cast between types of the same length. > > Strictly speaking, strict aliasing just says that locations pointed

Re: [Numpy-discussion] MoinMoin <-> docstrings gateway

2008-05-04 Thread Gael Varoquaux
On Mon, May 05, 2008 at 03:17:20AM +0300, Pauli Virtanen wrote: > Some time ago there was discussion about MoinMoin <-> docstrings > gateway. Did it produce some results? My girlfriend, Emmanuelle, (Cced, I am not sure she follows this mailing list) has been working on this, with some progress. >

Re: [Numpy-discussion] strict aliasing?

2008-05-04 Thread David Cournapeau
Charles R Harris wrote: > > As far as I can tell, strict aliasing assumes that pointers are only > cast between types of the same length. Strictly speaking, strict aliasing just says that locations pointed by pointers do not alias. If you use two pointers of different types, that's one case wh

Re: [Numpy-discussion] Faster

2008-05-04 Thread Christopher Barker
Keith Goodman wrote: > Why is it so slow to copy data I think the speed of copying data is highly dependent on what's in cache, but in any case, much faster than: > create an empty array? creating a new array requires a memory allocation, which is apparently a bunch slower than moving data aro

Re: [Numpy-discussion] Faster

2008-05-04 Thread Keith Goodman
On Sun, May 4, 2008 at 5:59 PM, Damian R. Eads <[EMAIL PROTECTED]> wrote: > Hi, > > Looks like a fun discussion: it's too bad for me I did not join it > earlier. My first try at scipy-cluster was completely in Python. Like you, > I also tried to find the most efficient way to transform the dista

Re: [Numpy-discussion] Faster

2008-05-04 Thread Damian R. Eads
Hi, Looks like a fun discussion: it's too bad for me I did not join it earlier. My first try at scipy-cluster was completely in Python. Like you, I also tried to find the most efficient way to transform the distance matrix when joining two clusters. Eventually my data sets became big enough that I

Re: [Numpy-discussion] MoinMoin <-> docstrings gateway

2008-05-04 Thread Jarrod Millman
On Sun, May 4, 2008 at 7:17 PM, Pauli Virtanen <[EMAIL PROTECTED]> wrote: > Anyway, I threw a bit of code together. There's something between a > proof-of-concept and final product running now on my desktop machine. > You can play with it here: > > http://pvx.homeip.net/pTSc0V/TestWiki >

[Numpy-discussion] MoinMoin <-> docstrings gateway

2008-05-04 Thread Pauli Virtanen
Hi, Some time ago there was discussion about MoinMoin <-> docstrings gateway. Did it produce some results? Anyway, I threw a bit of code together. There's something between a proof-of-concept and final product running now on my desktop machine. You can play with it here: http://pvx.homei

[Numpy-discussion] [IT] (updated) Maintenance and scheduled downtime this evening and weekend

2008-05-04 Thread Peter Wang
Hi everyone, We will need to do some more on the network today, Sunday May 4, from 1pm to 3pm Central time. (This is 2pm-4pm Eastern, 6pm-8pm UTC.) This affects the main Enthought and Scipy.org servers, including SVN, Trac, the mailing lists, and the web site. As usual, we don't anticip

Re: [Numpy-discussion] strict aliasing?

2008-05-04 Thread Charles R Harris
On Sun, May 4, 2008 at 3:11 AM, Neal Becker <[EMAIL PROTECTED]> wrote: > Is it safe to compile numpy with gcc 'strict aliasing'? > No! And depending on the compiler version you might find whole bits of code disappearing during optimization without warning, yielding fantastic benchmarks but quest

Re: [Numpy-discussion] Faster

2008-05-04 Thread Keith Goodman
On Fri, May 2, 2008 at 7:25 PM, Robert Kern <[EMAIL PROTECTED]> wrote: > Assuming x is contiguous and you can modify x in-place: > > > In [1]: from numpy import * > > In [2]: def dist(x): >...:x = x + 1e10 * eye(x.shape[0]) >...:i, j = where(x == x.min()) > >...:return i[

Re: [Numpy-discussion] Faster

2008-05-04 Thread Keith Goodman
On Sun, May 4, 2008 at 8:14 AM, Hoyt Koepke <[EMAIL PROTECTED]> wrote: > > and then update the others only if the row you're updating has that > > minimum value in it. Then, when scanning for the min dist, you only > > need to scan O(n) rows. > > Sorry, let me clarify -- Update the entries c

Re: [Numpy-discussion] Faster

2008-05-04 Thread Hoyt Koepke
> and then update the others only if the row you're updating has that > minimum value in it. Then, when scanning for the min dist, you only > need to scan O(n) rows. Sorry, let me clarify -- Update the entries corresponding to entries in the row you're updating if they are the same as the mini

Re: [Numpy-discussion] Faster

2008-05-04 Thread Hoyt Koepke
Another realization after looking at your code again -- you are doing extra work recomputing the minimum distance over d at each step. Since you are only updating one column and one row, you can have a length n array that gives the minimum (or max) distance for each column, then, after merging, you

Re: [Numpy-discussion] Faster

2008-05-04 Thread Keith Goodman
On Sun, May 4, 2008 at 7:40 AM, Timothy Hochberg <[EMAIL PROTECTED]> wrote: > If you don't need the old array after the cut, I think that you could use > the input array as the output array and then take a slice, saving a > temporary and one-quarter of your assignments (on average). Something like.

Re: [Numpy-discussion] Faster

2008-05-04 Thread Timothy Hochberg
On Sat, May 3, 2008 at 5:31 PM, Keith Goodman <[EMAIL PROTECTED]> wrote: > On Sat, May 3, 2008 at 5:05 PM, Christopher Barker > <[EMAIL PROTECTED]> wrote: > > Robert Kern wrote: > > > I can get a ~20% improvement with the following: > > > > > > > In [9]: def mycut(x, i): > > >...: A = x[

Re: [Numpy-discussion] strict aliasing?

2008-05-04 Thread Andreas Klöckner
On Sonntag 04 Mai 2008, Neal Becker wrote: > Is it safe to compile numpy with gcc 'strict aliasing'? It seems that numpy (and most other Python-related C code) would constantly be casting back and forth between PyObject * and PyArrayObject * (and others). Does strict aliasing allow that, as long

Re: [Numpy-discussion] python memory use

2008-05-04 Thread Muhammad Alkarouri
--- Robin <[EMAIL PROTECTED]> wrote: [...] > While investigating this I found this script: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/511474 > which does wonders for my code. I was wondering if this function > should be included in Numpy as it seems to provide an important > feature

Re: [Numpy-discussion] Learn about numpy

2008-05-04 Thread Nadav Horesh
What you do here is a convolution with 0 1 0 1 1 1 0 1 0 kernel, and thresholding, you can use numpy.numarray.nd_image package: import numpy.numarray.nd_image as NI . . . ker = array([[0,1,0], [1,1,1],[0,1,0]]) result = (NI.convolve(self.bufbw, ker) == 1).astype(uint8) for nore general c

[Numpy-discussion] Learn about numpy

2008-05-04 Thread Folkert Boonstra
With a python background but new to numpy, I have the following. Suppose I have a 2-D array and I want to apply a function to each element. The function needs to access the direct neighbouring elements in order to set a new value for the element. How would I do that in the most efficient way with

[Numpy-discussion] strict aliasing?

2008-05-04 Thread Neal Becker
Is it safe to compile numpy with gcc 'strict aliasing'? ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion