65 constexpr size_t size = V1::size();
66 static_assert(size == V2::size(),
"Sort in and out vectors/matrices should be of same size.");
67 typename V1::value_type temp[size];
69 for (
int width = 1; width < size; width *= 2) {
74 if (i2 >= size) i2 = size;
75 if (i3 >= size) i3 = size;
77 for (
int i = 0; i < size; ++i) {
79 typename V1::value_type t1 = in[f1];
81 typename V1::value_type t2 = (f2 == i3) ?
static_cast<typename V1::value_type
>(0) : in[f2];
82 if (f2 == i3 || (f1 < i2 && t1 <= t2)) {
90 if (f1 == i2 && f2 == i3) {
94 if (i2 >= size) i2 = size;
95 if (i3 >= size) i3 = size;
113static inline void argmax_4_2(T in1, T in2, T in3, T in4, I i_in1, I i_in2, I i_in3, I i_in4, T& out1, T& out2,
114 I& i_out1, I& i_out2,
bool sorted =
false) {
117 assert(in1 >= in2 && in3 >= in4 &&
"Should be sorted in flames::argmax_4_2 with sorted=true.");
123 }
else if (in3 < in2) {
128 }
else if (in1 < in3) {
140 T _in1, _in2, _in3, _in4;
141 I _i_in1, _i_in2, _i_in3, _i_in4;
171 }
else if (_in3 < _in2) {
176 }
else if (_in1 < _in3) {
static void argmax_4_2(T in1, T in2, T in3, T in4, I i_in1, I i_in2, I i_in3, I i_in4, T &out1, T &out2, I &i_out1, I &i_out2, bool sorted=false)
Definition sort.hpp:113