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;

Clamp each entry to an interval: \(x_i \leftarrow \min(\max(x_i, \mathrm{lo}), \mathrm{hi})\).