bitstring

This commit is contained in:
rasbt 2014-09-23 13:34:17 -04:00
parent 01fbbeb69c
commit 21e4d5e813

View File

@ -6,6 +6,9 @@ def make_bitstring(ary)
return np.where(ary > 0, 1, 0) return np.where(ary > 0, 1, 0)
def faster_bitstring(ary)
return np.where(ary > 0).astype('i1')
### Example: ### Example:
ary1 = np.array([1, 2, 0.3, -1, -2]) ary1 = np.array([1, 2, 0.3, -1, -2])