[Numpy-discussion] non-linear array manipulation

Nadav Horesh nadavh at visionsense.com
Tue Aug 12 11:57:32 EDT 2008


from numpy import *

a = sqrt(maximum(0, a**2-repeat(b*c, columns).reshape(rows, columns)))

  Nadav


-----הודעה מקורית-----
מאת: numpy-discussion-bounces at 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]) )


thanks,
Shawn




-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 3097 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080812/48a0d0e6/attachment.bin>


More information about the NumPy-Discussion mailing list