55 const int nb_elt = T.size();
62 for (
int first =
nb_elt/2; first > 0; -- first)
65 Type value = T[
shift0 + first];
67 int i=first,
j=2*first;
73 if (value >= T[
shift0 +
j])
break;
83#ifdef STK_HEAPSORT_DEBUG
84 std::cout <<
"T=\n" << T.asDerived() <<
_T(
"\n";);
103 if (value >= T[
shift0 +
j])
break;
121template<
class Vector>
127 Tsort = T.asDerived();
136 for (
int first =
nb_elt/2; first > 0; -- first)
141 int i=first,
j=2*first;
157#ifdef STK_HEAPSORT_DEBUG
158 std::cout <<
"T=\n" <<
Tsort <<
_T(
"\n";);
196template<
class Vector,
class VectorInt>
207 I.asDerived().resize(T.range());
208 int first =
I.begin(),
last =
I.lastIdx();
209 for (
int i=first;
i<=
last;
i++)
218 for (first =
nb_elt/2; first > 0; --first)
221 Type value = T[
I[
shift0 + first]];
223 int i=first,
j=2*first;
229 if (value >= T[
I[
shift0 +
j]])
break;
239#ifdef STK_HEAPSORT_DEBUG
240 std::cout <<
"I=\n" <<
I <<
"\n";
263 if (value >= T[
I[
shift0 +
j]])
break;
275#ifdef STK_HEAPSORT_DEBUG
276 std::cout <<
"I=\n" <<
I <<
"\n";
286template<
class Vector,
class VectorInt>
291#ifdef STK_BOUNDS_CHECK
292 if (
I.range() != T.range())
296 for (
int i=
I.begin();
i<
I.end();
i++) {
A[
i] = T[
I[
i]];}
305template <
class Array,
class VectorInt>
309#ifdef STK_BOUNDS_CHECK
310 if (
I.range() != T.rows())
313 Array
A(T.rows(), T.cols());
314 for (
int i=
I.begin();
i<
I.end();
i++) {
A.row(
i) = T.row(
I[
i]);}
#define STKRUNTIME_ERROR_2ARG(Where, Arg1, Arg2, Error)
#define STK_STATIC_ASSERT_ONE_DIMENSION_ONLY(EXPR)
#define _T(x)
Let x unmodified.
hidden::Traits< Array2DVector< Real > >::Type Type
Derived & move(Derived const &T)
move T to this.
The MultidimRegression class allows to regress a multidimensional output variable among a multivariat...
void heapSort(Vector &T)
Sort the container T in ascending order.
void applySort2D(Array &T, VectorInt const &I)
Apply a sorting index array to the 2D container T row by row.
void applySort1D(Vector &T, VectorInt const &I)
Apply a sorting index array to the 1D container T.
The namespace STK is the main domain space of the Statistical ToolKit project.