Skip to content

num::kernel::clamp

Defined in header <kernel/vector.hpp>

template <std::floating_point T>
void clamp(T *x, T lo, T hi, idx n) noexcept;

In-place vector element clamp \(x_i \leftarrow \min(\max(x_i, x_{\min}), x_{\max})\).