Re: [Numpy-discussion] Optimizing a pure Python Workaround

2009-07-13 Thread Robert Kern
On Mon, Jul 13, 2009 at 18:11, Ian Mallett wrote: > Hello, > > I have some code that makes vertex buffer object terrain.  Because the setup > for this (a series of triangle strips) is a bit clunky, I just implemented > the tricky parts in Python. > > The code works, but it's slow.  How should I go

Re: [Numpy-discussion] suggestion for generalizing numpy functions

2009-07-13 Thread Darren Dale
2009/7/13 Stéfan van der Walt > Hi Darren > > 2009/7/13 Darren Dale : > > I've put together a first cut at implementing __array_prepare__, which > > appears to work, and I would like to request feedback. Here is an > overview > > of the approach: > > This is pretty neat! Do you have a quick snip

[Numpy-discussion] Optimizing a pure Python Workaround

2009-07-13 Thread Ian Mallett
Hello, I have some code that makes vertex buffer object terrain. Because the setup for this (a series of triangle strips) is a bit clunky, I just implemented the tricky parts in Python. The code works, but it's slow. How should I go about optimizing it? Thanks, Ian size = [#int_something,#in

Re: [Numpy-discussion] suggestion for generalizing numpy functions

2009-07-13 Thread Stéfan van der Walt
Hi Darren 2009/7/13 Darren Dale : > I've put together a first cut at implementing __array_prepare__, which > appears to work, and I would like to request feedback. Here is an overview > of the approach: This is pretty neat! Do you have a quick snippet at hand illustrating its use? Regards Stéfa

Re: [Numpy-discussion] suggestion for generalizing numpy functions

2009-07-13 Thread Darren Dale
I've put together a first cut at implementing __array_prepare__, which appears to work, and I would like to request feedback. Here is an overview of the approach: Once the ufunc machinery has created the output arrays, it is time to offer subclasses a chance to initialize the output arrays and det

Re: [Numpy-discussion] find_common_type broken?

2009-07-13 Thread Ralf Gommers
On Sun, Jul 12, 2009 at 1:24 PM, Citi, Luca wrote: > > That is what I thought at first, but then what is the difference between > > array_types and scalar_types? Function signature is: > > *find_common_type(array_types, scalar_types)* > As I understand it, the difference is that in the following

[Numpy-discussion] Using interpolate with zero-rank array raises error

2009-07-13 Thread Tony Yu
(Sorry if this is a duplicate; I think sent this from the wrong email the first time) When using interpolate with a zero-rank array, I get "ValueError: object of too small depth for desired array". The following code reproduces this issue >>> import numpy as np >>> x0 = np.array(0.1) >>>

Re: [Numpy-discussion] Optimizing reduction loops (sum(), prod(), et al.)

2009-07-13 Thread Citi, Luca
Hi Pauli, in my PC I have tried this and some of the regressions disappear, maybe you can give it a try. At the present state is compiler- and architecture-dependent, therefore not the best choice. But it may be worth trying. Best, Luca /* My additions are unindented */ /*

Re: [Numpy-discussion] Optimizing reduction loops (sum(), prod(), et al.)

2009-07-13 Thread Pauli Virtanen
Wed, 08 Jul 2009 22:16:22 +, Pauli Virtanen kirjoitti: [clip] > On an older CPU (slower, smaller cache), the situation is slightly > different: > > http://www.iki.fi/pav/tmp/athlon.png > http://www.iki.fi/pav/tmp/athlon.txt > > On average, it's still an improvement in many cases. How