[Numpy-discussion] non-linear array manipulation

Gong, Shawn (Contractor) Shawn.Gong@drdc-rddc.gc...
Tue Aug 12 11:41:02 CDT 2008

thank you, Nadav

-----Original Message-----
From: numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-bounces@scipy.org] 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(maximum(0, a**2-repeat(b*c, columns).reshape(rows, columns)))


-----הודעה מקורית-----
מאת: numpy-discussion-bounces@scipy.org בשם Gong, Shawn (Contractor)
נשלח: ג 12-אוגוסט-08 17:37
אל: Discussion of Numerical Python
נושא: [Numpy-discussion] non-linear array manipulation
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( max(0.0, a[i][j]*a[i][j] - b[j]*c[j]) )


More information about the Numpy-discussion mailing list