Re: [Numpy-discussion] Arrays of Python Values

2010-07-25 Thread Ian Mallett
Hi, I've converted all of the code to use record arrays, for a 10-fold speed boost. Thanks, Ian ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Arrays of Python Values

2010-07-23 Thread Hans Meine
On Friday 23 July 2010 10:16:41 Ian Mallett wrote: > self.patches.sort( lambda x,y:cmp(x.residual_radiance,y.residual_radiance), > reverse=True ) Using sort(key = lambda x: x.residual_radiance) should be faster. > Because I've never used arrays of Python objects (and Googling didn't turn > up any

Re: [Numpy-discussion] Arrays of Python Values

2010-07-23 Thread Pauli Virtanen
Fri, 23 Jul 2010 01:16:41 -0700, Ian Mallett wrote: [clip] > Because I've never used arrays of Python objects (and Googling didn't > turn up any examples), I'm stuck on how to sort the corresponding array > in NumPy in the same way. I doubt you will gain any speed by switching from Python lists to

Re: [Numpy-discussion] Arrays of Python Values

2010-07-23 Thread Jon Wright
Ian Mallett wrote: > self.patches.sort( lambda > x,y:cmp(x.residual_radiance,y.residual_radiance), reverse=True ) > ... > > more, but I couldn't figure out how I'd handle the different attributes > (or specifically, how to keep them together during a sort). I'm not sure you gain much using num

[Numpy-discussion] Arrays of Python Values

2010-07-23 Thread Ian Mallett
Hi, So working on the radiosity renderer: http://a.imageshack.us/img186/2479/image2f.png. The code now runs fast enough to generate the data required to draw that. Now, I need to optimize the radiosity calculation, so that it will converge in a reasonable amount of time. Right now, the individua