limit function

Limit the magnitude of elements of a vector