[Numpy-discussion] [Q]Best way for an array operation?
Paul F. Dubois
pauldubois at home.com
Sat Oct 14 10:58:37 CDT 2000
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.
From: numpy-discussion-admin at lists.sourceforge.net
[mailto:numpy-discussion-admin at lists.sourceforge.net]On Behalf Of
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
Numpy-discussion at lists.sourceforge.net
More information about the Numpy-discussion