PLearn 0.1
|
#include <TMat_sort.h>
Public Types | |
typedef T | first_argument_type |
typedef T | second_argument_type |
typedef bool | result_type |
Public Member Functions | |
SelectedIndicesCmp (TVec< int > the_indices, bool use_lexical_less_than=true) | |
bool | operator() (const T &x, const T &y) |
Private Attributes | |
TVec< int > | indices |
bool | use_less_than |
Definition at line 58 of file TMat_sort.h.
typedef T PLearn::SelectedIndicesCmp< T >::first_argument_type |
Definition at line 65 of file TMat_sort.h.
typedef bool PLearn::SelectedIndicesCmp< T >::result_type |
Definition at line 67 of file TMat_sort.h.
typedef T PLearn::SelectedIndicesCmp< T >::second_argument_type |
Definition at line 66 of file TMat_sort.h.
PLearn::SelectedIndicesCmp< T >::SelectedIndicesCmp | ( | TVec< int > | the_indices, |
bool | use_lexical_less_than = true |
||
) | [inline] |
Definition at line 69 of file TMat_sort.h.
:indices(the_indices), use_less_than(use_lexical_less_than) {}
bool PLearn::SelectedIndicesCmp< T >::operator() | ( | const T & | x, |
const T & | y | ||
) | [inline] |
Definition at line 73 of file TMat_sort.h.
{ int n = indices.length(); if(use_less_than) // lexical < { for(int k=0; k<n; k++) { int i = indices[k]; if(x[i]<y[i]) return true; else if(x[i]>y[i]) return false; } return false; } else // lexical > { for(int k=0; k<n; k++) { int i = indices[k]; if(x[i]>y[i]) return true; else if(x[i]<y[i]) return false; } return false; } }
TVec<int> PLearn::SelectedIndicesCmp< T >::indices [private] |
Definition at line 61 of file TMat_sort.h.
bool PLearn::SelectedIndicesCmp< T >::use_less_than [private] |
Definition at line 62 of file TMat_sort.h.