Re: [Numpy-discussion] non-linear array manipulation

2008-08-13 Thread Daniel Lenski
On Tue, 12 Aug 2008 10:37:51 -0400, Gong, Shawn (Contractor) wrote: > The following array manipulation takes long time because I can't find > ways to do in row/column, and have to do cell by cell. Would you check > to see if there is a nicer/faster way for this non-linear operation? > > for i in

Re: [Numpy-discussion] non-linear array manipulation

2008-08-12 Thread Anne Archibald
2008/8/12 Nadav Horesh <[EMAIL PROTECTED]>: > from numpy import * > > a = sqrt(maximum(0, a**2-repeat(b*c, columns).reshape(columns, rows))) better: import numpy as np a = np.sqrt(np.maximum(0.0, a**2-(b*c)[np.newaxis,:])) This doesn't have to make a temporary the size of a; instead broadcastin

Re: [Numpy-discussion] non-linear array manipulation

2008-08-12 Thread Gong, Shawn (Contractor)
thank you, Nadav Shawn -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Nadav Horesh Sent: Tuesday, August 12, 2008 11:58 AM To: Discussion of Numerical Python Subject: RE: [Numpy-discussion] non-linear array manipulation from numpy import * a = sqrt

Re: [Numpy-discussion] non-linear array manipulation

2008-08-12 Thread Nadav Horesh
from numpy import * a = sqrt(maximum(0, a**2-repeat(b*c, columns).reshape(rows, columns))) Nadav -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Gong, Shawn (Contractor) נשלח: ג 12-אוגוסט-08 17:37 אל: Discussion of Numerical Python נושא: [Numpy-discussion] non-linear array manipulation

Re: [Numpy-discussion] non-linear array manipulation

2008-08-12 Thread Nadav Horesh
from numpy import * a = sqrt(maximum(0, a**2-repeat(b*c, columns).reshape(columns, rows))) Nadav. -הודעה מקורית- מאת: [EMAIL PROTECTED] בשם Gong, Shawn (Contractor) נשלח: ג 12-אוגוסט-08 17:37 אל: Discussion of Numerical Python נושא: [Numpy-discussion] non-linear array manipulation hi

[Numpy-discussion] non-linear array manipulation

2008-08-12 Thread Gong, Shawn (Contractor)
hi list, The following array manipulation takes long time because I can't find ways to do in row/column, and have to do cell by cell. Would you check to see if there is a nicer/faster way for this non-linear operation? for i in range(rows): for j in range(columns): a[i][j] = math.sqrt(