Classes | |
struct | arma_sort_index_packet_ascend< T1, T2 > |
struct | arma_sort_index_packet_descend< T1, T2 > |
struct | sort_index_result_type_deducer< T > |
struct | sort_index_result_type_deducer< Col< eT > > |
struct | sort_index_result_type_deducer< Row< eT > > |
Functions | |
template<typename T1 , typename T2 > | |
bool | operator< (const arma_sort_index_packet_ascend< T1, T2 > &A, const arma_sort_index_packet_ascend< T1, T2 > &B) |
template<typename T1 , typename T2 > | |
bool | operator< (const arma_sort_index_packet_descend< T1, T2 > &A, const arma_sort_index_packet_descend< T1, T2 > &B) |
template<typename umat_elem_type , typename packet_type , typename eT > | |
void | sort_index_helper (umat_elem_type *out_mem, std::vector< packet_type > &packet_vec, const eT *in_mem) |
template<typename T1 > | |
sort_index_result_type_deducer < T1 >::out_type | sort_index (const Base_vec< typename T1::elem_type, T1 > &X, const u32 sort_type=0) |
bool operator< | ( | const arma_sort_index_packet_ascend< T1, T2 > & | A, | |
const arma_sort_index_packet_ascend< T1, T2 > & | B | |||
) | [inline] |
bool operator< | ( | const arma_sort_index_packet_descend< T1, T2 > & | A, | |
const arma_sort_index_packet_descend< T1, T2 > & | B | |||
) | [inline] |
void sort_index_helper | ( | umat_elem_type * | out_mem, | |
std::vector< packet_type > & | packet_vec, | |||
const eT * | in_mem | |||
) | [inline] |
Definition at line 63 of file fn_sort_index.hpp.
References sort().
Referenced by sort_index().
00064 { 00065 arma_extra_debug_sigprint(); 00066 00067 const u32 n_elem = packet_vec.size(); 00068 00069 for(u32 i=0; i<n_elem; ++i) 00070 { 00071 packet_vec[i].val = in_mem[i]; 00072 packet_vec[i].index = i; 00073 } 00074 00075 std::sort( packet_vec.begin(), packet_vec.end() ); 00076 00077 for(u32 i=0; i<n_elem; ++i) 00078 { 00079 out_mem[i] = packet_vec[i].index; 00080 } 00081 }
sort_index_result_type_deducer<T1>::out_type sort_index | ( | const Base_vec< typename T1::elem_type, T1 > & | X, | |
const u32 | sort_type = 0 | |||
) | [inline] |
Definition at line 114 of file fn_sort_index.hpp.
References Base_vec< elem_type, derived_vec >::get_ref(), and sort_index_helper().
00115 { 00116 arma_extra_debug_sigprint(); 00117 00118 typedef typename T1::elem_type eT; 00119 00120 arma_type_check< is_complex<eT>::value == true>::apply(); 00121 00122 const unwrap<T1> tmp(X.get_ref()); 00123 const Mat<eT>& A = tmp.M; 00124 00125 arma_debug_check( (A.is_vec() == false), "sort_index(): internal error: expected a vector"); 00126 00127 typedef typename sort_index_result_type_deducer<T1>::out_type out_type; 00128 typedef typename out_type::elem_type out_elem_type; 00129 00130 out_type out(A.n_elem); 00131 00132 00133 if(sort_type == 0) 00134 { 00135 std::vector< arma_sort_index_packet_ascend<eT,out_elem_type> > packet_vec(A.n_elem); 00136 00137 sort_index_helper(out.memptr(), packet_vec, A.mem); 00138 00139 return out; 00140 } 00141 else 00142 { 00143 std::vector< arma_sort_index_packet_descend<eT,out_elem_type> > packet_vec(A.n_elem); 00144 00145 sort_index_helper(out.memptr(), packet_vec, A.mem); 00146 00147 return out; 00148 } 00149 00150 }