Given a real (n), a maximum value this real can be (upper), and a minimum value this real can be (lower), how can we most efficiently clip n, such that it remains between lo
If you wish to use xtensor, it would support multi-dimensional arrays and the solution would be very elegant.
#include
#include "xtensor/xarray.hpp"
#include "xtensor/xio.hpp"
#include "xtensor/xview.hpp"
#include "xtensor/xrandom.hpp"
xt::xarray ar({2.1, 2.9, -2.1, -2.9});
std::cout<(xt::trunc(ar))<
//Answer is { 2, 2, -2, -2 }