I have a numpy float matrix and I want to set all values within this matrix to zero which absolute value is lower than a given threshold.
set x = 0 if -threshold < x < threshold.
An easy solution would be to do a loop over all elements in this matrix, but this is time consuming. numpy.clip is very fast, but clipping values higher than a max threshold or lower than a min threshold. Are there any better ways than looping over all values?