[Numpy-discussion] non-linear array manipulation

Nadav Horesh nadavh@visionsense....
Tue Aug 12 10:22:05 CDT 2008


from numpy import *

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

  Nadav.
-----הודעה מקורית-----
מאת: 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]) )


thanks,
Shawn




-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3097 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080812/e4ce4f6f/attachment.bin 


More information about the Numpy-discussion mailing list