20 template<
typename T1,
typename T2>
29 template<
typename T1,
typename T2>
38 template<
typename T1,
typename T2>
48 template<
typename T1,
typename T2>
58 template<
typename umat_elem_type,
typename packet_type,
typename eT>
61 sort_index_helper(umat_elem_type* out_mem, std::vector<packet_type>& packet_vec,
const eT* in_mem)
65 const uword n_elem = packet_vec.size();
67 for(
uword i=0; i<n_elem; ++i)
69 packet_vec[i].val = in_mem[i];
70 packet_vec[i].index = i;
73 std::sort( packet_vec.begin(), packet_vec.end() );
75 for(
uword i=0; i<n_elem; ++i)
77 out_mem[i] = packet_vec[i].index;
90 typedef typename T1::elem_type eT;
97 if(A.is_empty() ==
true)
102 arma_debug_check( (A.is_vec() ==
false),
"sort_index(): currently only handles vectors");
106 umat out(A.n_rows, A.n_cols);
110 std::vector< arma_sort_index_packet_ascend<eT,out_elem_type> > packet_vec(A.n_elem);
116 std::vector< arma_sort_index_packet_descend<eT,out_elem_type> > packet_vec(A.n_elem);
arma_inline arma_warn_unused eT * memptr()
returns a pointer to array of eTs used by the matrix
arma_inline const derived & get_ref() const
umat sort_index(const Base< typename T1::elem_type, T1 > &X, const uword sort_type=0)
#define arma_type_check(condition)
void sort_index_helper(umat_elem_type *out_mem, std::vector< packet_type > &packet_vec, const eT *in_mem)
eT elem_type
the type of elements stored in the matrix
#define arma_extra_debug_sigprint
arma_inline const Op< T1, op_sort > sort(const Base< typename T1::elem_type, T1 > &X, const uword sort_type=0, const uword dim=0)