From: Paul F. D. <pau...@ho...> - 2000-10-14 16:01:36
|
There is (in CVS) a new function, putmask: c = greater(x, 0) putmask(y, c, v) putmask(z, c, u+2) The documentation is now online. Briefly: putmask(a, m, v) sets a to v where m is true. a must be a contiguous array m must be the same total size as a (shape ignored) v will be repeated as needed to that size The underlying work is done in C. -----Original Message----- From: num...@li... [mailto:num...@li...]On Behalf Of Daehyok Shin Sent: Friday, October 13, 2000 5:26 PM To: Numpy Discussion Subject: [Numpy-discussion] [Q]Best way for an array operation? What is the best Numpy way for the following work? for i in range(len(x)): if x[i] > 0: y[i] = v[i] z[i] = u[i]+2 Daehyok Shin (Peter) _______________________________________________ Numpy-discussion mailing list Num...@li... http://lists.sourceforge.net/mailman/listinfo/numpy-discussion |