Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

PLearn::BottomNI< T > Class Template Reference

#include <BottomNI.h>

Collaboration diagram for PLearn::BottomNI< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BottomNI ()
 Default constructor, you must then call init.

 BottomNI (int the_N)
 N is the number of (value,index) pairs to remember.

void init (int the_N)
 N is the number of (value,point) pairs to remember.

void reset ()
void update (T value, int index)
 call this for each new value seen

int nZeros () const
void sort ()
const TVec< pair< T, int > > & getBottomN ()
 call this at the end to get the the smallest N values with associated integer index


Protected Attributes

int n_zeros
 number of zeros

int N
TVec< pair< T, int > > bottomn
pair< T, int > * bottomnptr
 bottomn.data()

pair< T, int > * maxpair

Detailed Description

template<class T>
class PLearn::BottomNI< T >

This is a very simple class, that allows you to keep track of the bottom N values encountered among many and their associated integer index (or corresponding position). For keeping track of the TOP N values, see the companion class TopNI.

Definition at line 62 of file BottomNI.h.


Constructor & Destructor Documentation

template<class T>
PLearn::BottomNI< T >::BottomNI  )  [inline]
 

Default constructor, you must then call init.

Definition at line 74 of file BottomNI.h.

template<class T>
PLearn::BottomNI< T >::BottomNI int  the_N  )  [inline]
 

N is the number of (value,index) pairs to remember.

Definition at line 78 of file BottomNI.h.

References PLearn::BottomNI< T >::init().


Member Function Documentation

template<class T>
const TVec< pair<T,int> >& PLearn::BottomNI< T >::getBottomN  )  [inline]
 

call this at the end to get the the smallest N values with associated integer index

Definition at line 127 of file BottomNI.h.

References PLearn::BottomNI< T >::bottomn.

Referenced by PLearn::computeNearestNeighbors(), and PLearn::VMatrix::evaluateKernelBottomN().

template<class T>
void PLearn::BottomNI< T >::init int  the_N  )  [inline]
 

N is the number of (value,point) pairs to remember.

< reserve space for N elements

< set length back to 0

< ptr for faster access

Definition at line 81 of file BottomNI.h.

References PLearn::BottomNI< T >::bottomn, PLearn::BottomNI< T >::bottomnptr, PLearn::TVec< pair< T, int > >::data(), PLearn::BottomNI< T >::init(), PLearn::BottomNI< T >::N, PLearn::BottomNI< T >::n_zeros, and PLearn::TVec< pair< T, int > >::resize().

Referenced by PLearn::BottomNI< T >::BottomNI(), and PLearn::BottomNI< T >::init().

template<class T>
int PLearn::BottomNI< T >::nZeros  )  const [inline]
 

Definition at line 121 of file BottomNI.h.

References PLearn::BottomNI< T >::n_zeros.

Referenced by PLearn::computeNearestNeighbors().

template<class T>
void PLearn::BottomNI< T >::reset  )  [inline]
 

Definition at line 90 of file BottomNI.h.

References PLearn::BottomNI< T >::N.

template<class T>
void PLearn::BottomNI< T >::sort  )  [inline]
 

Definition at line 123 of file BottomNI.h.

References PLearn::BottomNI< T >::bottomn, PLearn::BottomNI< T >::bottomnptr, and PLearn::TVec< pair< T, int > >::length().

Referenced by PLearn::computeNearestNeighbors(), and PLearn::VMatrix::evaluateKernelBottomN().

template<class T>
void PLearn::BottomNI< T >::update value,
int  index
[inline]
 

call this for each new value seen

find the new maximum:

Definition at line 93 of file BottomNI.h.

References PLearn::TVec< pair< T, int > >::append(), PLearn::BottomNI< T >::bottomn, PLearn::BottomNI< T >::bottomnptr, PLearn::TVec< pair< T, int > >::length(), PLearn::BottomNI< T >::maxpair, PLearn::BottomNI< T >::N, and PLearn::BottomNI< T >::n_zeros.

Referenced by PLearn::computeNearestNeighbors(), and PLearn::VMatrix::evaluateKernelBottomN().


Member Data Documentation

template<class T>
TVec< pair<T,int> > PLearn::BottomNI< T >::bottomn [protected]
 

Definition at line 67 of file BottomNI.h.

Referenced by PLearn::BottomNI< T >::getBottomN(), PLearn::BottomNI< T >::init(), PLearn::BottomNI< T >::sort(), and PLearn::BottomNI< T >::update().

template<class T>
pair<T,int>* PLearn::BottomNI< T >::bottomnptr [protected]
 

bottomn.data()

Definition at line 68 of file BottomNI.h.

Referenced by PLearn::BottomNI< T >::init(), PLearn::BottomNI< T >::sort(), and PLearn::BottomNI< T >::update().

template<class T>
pair<T,int>* PLearn::BottomNI< T >::maxpair [protected]
 

Definition at line 69 of file BottomNI.h.

Referenced by PLearn::BottomNI< T >::update().

template<class T>
int PLearn::BottomNI< T >::N [protected]
 

Definition at line 66 of file BottomNI.h.

Referenced by PLearn::BottomNI< T >::init(), PLearn::BottomNI< T >::reset(), and PLearn::BottomNI< T >::update().

template<class T>
int PLearn::BottomNI< T >::n_zeros [protected]
 

number of zeros

Definition at line 65 of file BottomNI.h.

Referenced by PLearn::BottomNI< T >::init(), PLearn::BottomNI< T >::nZeros(), and PLearn::BottomNI< T >::update().


The documentation for this class was generated from the following file:
Generated on Tue Aug 17 16:23:48 2004 for PLearn by doxygen 1.3.7