There just *has* to be a better way of doing this. I want to cut off small
values of a vector, and I'm currently doing something like:

>>> for i in xrange(n):
>>>    if abs(A[i]) < tol: A[i] = 0

Which is slow, since A can be really long. Is there a way to write a Ufunc
that would do something like this more directly? The naive things I've tried
didn't work, e.g.

>>> def cut(a,tol=1e-10):
>>>     if less(absolute(a),tol):
>>>         a = 0
>>>     return

-- 
Rick Muller
[email protected]
505-750-7557
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to