Limit every element to a minimum and maximum bound.
Numeric.math.clip(value, lower, upper)Applies bounds across nested numeric inputs.
- Parameters:
value: Scalar, vector, or matrix input valueslower: Lower bound applied to each elementupper: Upper bound applied to each element
- Returns: Clipped values matching the input nesting shape
- NumPy: Covers
np.clip,ndarray.clipthrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const value = Numeric.math.clip(5, 0, 3)
console.log(value)
// 3import Numeric from '@neabyte/numerix'
const values = Numeric.math.clip([-5, 0, 5], -1, 1)
console.log(values)
// [-1,0,1]import Numeric from '@neabyte/numerix'
const values = Numeric.math.clip([[-5, 0], [5, 10]], 0, 3)
console.log(values)
// [[0,0],[3,3]]import Numeric from '@neabyte/numerix'
const value = Numeric.math.clip(-5, 0)
console.log(value)
// 0