clip

fun <T : Comparable<T>, Number, D : Dimension> MultiArray<T, D>.clip(min: T, max: T): NDArray<T, D>

Clips the values in ndarray if value is not in range min..max

values bigger than max are set to max

values smaller than min are set to min

Return

NDArray of which all of its elements are in range min..max

Parameters

min

minimum value for clipping where any value in ndarray that is smaller than min are clipped and set to min

max

maximum value for clipping where any value in ndarray that is bigger than max are clipped and set to max

Throws