TRF Language Model
Related Data Structure

Namespaces

 wb::iter
 

Classes

class  wb::_wb_HEAP_UNIT_< TValue, TWeight >
 heap unit More...
 
class  wb::Heap< TValue, TWeight >
 heap More...
 
class  wb::vIter< T >
 
class  wb::LHash< KeyT, DataT >
 a linear hash table More...
 
class  wb::LHashIter< KeyT, DataT >
 the iter of LHash More...
 
class  wb::VecShell< T >
 
class  wb::Vec< T >
 
class  wb::MatShell< T >
 
class  wb::Mat< T >
 
class  wb::Mat3dShell
 
class  wb::Mat3d
 
class  wb::String
 a dynamic string class More...
 
class  wb::Trie< KeyT, DataT >
 trie structure More...
 
class  wb::TrieIter< KeyT, DataT >
 iter all the sub-tries More...
 
class  wb::TrieIter2< KeyT, DataT >
 Get all the values whose indexes are of a fixed length. The returned tries may not contain a legal values. More...
 
class  wb::Vector< T >
 this is the basic class of Array/Stack/Queue. Realize the dynamic memory management More...
 
class  wb::Array< T >
 Dynamic array. More...
 
class  wb::DArray< T >
 2-dimension array. More...
 
class  wb::Stack< T >
 A dynamic stack. More...
 
class  wb::Queue< T >
 A queue based the dynamic memory mangement. More...
 
class  wb::CirQueue< T >
 Circular queue. More...
 

Functions

template<class T >
bool wb::VecEqual (VecShell< T > &v1, VecShell< T > &v2)
 calculate V==V More...
 
template<class T >
void wb::VecAdd (VecShell< T > &res, VecShell< T > &v1, VecShell< T > &v2)
 calculate V + V More...
 
template<class T >
wb::VecDot (VecShell< T > &v1, VecShell< T > &v2)
 calculate V*V More...
 
template<class T >
wb::MatVec2 (MatShell< T > &m, VecShell< T > &v1, VecShell< T > &v2)
 calculate V1*M*V2 More...
 
template<typename T >
double wb::VecNorm (T *pVec, int len)
 [Vec-function] sqrt(v*v^T); More...
 
template<typename T >
double wb::VecDot (T *pVec1, T *pVec2, int len)
 [Vec-function] v1*v2^T More...
 
template<typename T >
double wb::VecDiff (T *pVec1, T *pVec2, int len)
 [Vec-function] |v1-v2| More...
 
template<typename T >
double wb::VecAngle (T *pVec1, T *pVec2, int len)
 [Vec-function] the cos of the angle of v1 and v2 More...
 
template<typename T >
void wb::VecUnfold (const char *pStr, Array< T > &a)
 [Vec-function] transform the matlab-style vector to a array, such as [1,3:1:7,9] => 1,3,4,5,6,7,9 More...
 
template<typename T >
int wb::Compar_Inc (const T &a, const T &b)
 comparing function for increase sort. More...
 
template<typename T >
int wb::Compar_Dec (const T &a, const T &b)
 comparing function for decrease sort More...
 
template<typename T >
void wb::Qsort (T *p, int low, int high, int(*compar)(const T &, const T &)=Compar_Inc)
 Quick sork. More...
 
template<typename T >
void wb::Qsort (Array< T > &a, int(*compar)(const T &, const T &)=Compar_Inc)
 Quick sork, redefine for class Array. More...
 
void wb::VecShell< T >::Fill (T v)
 
T & wb::VecShell< T >::operator[] (int i)
 
void wb::VecShell< T >::operator= (VecShell v)
 
void wb::VecShell< T >::operator+= (VecShell v)
 
void wb::VecShell< T >::operator-= (VecShell v)
 
void wb::VecShell< T >::operator*= (T n)
 
void wb::VecShell< T >::operator/= (T n)
 
bool wb::VecShell< T >::operator== (VecShell v)
 
void wb::Vec< T >::Reset (int size=0)
 
void wb::Vec< T >::Copy (VecShell< T > v)
 
void wb::MatShell< T >::Fill (T v)
 
bool wb::MatShell< T >::operator== (MatShell &m)
 
void wb::MatShell< T >::Write (File &file)
 
void wb::MatShell< T >::Read (File &file)
 
void wb::Mat< T >::Reset (int row=0, int col=0)
 
void wb::Mat< T >::Copy (MatShell< T > &m)
 
void wb::Mat3dShell::Fill (T v)
 
void wb::Mat3dShell::Write (File &file)
 
void wb::Mat3dShell::Read (File &file)
 
bool wb::Mat3dShell::operator== (Mat3dShell &m)
 
void wb::Mat3d::Reset (int xdim=0, int ydim=0, int zdim=0)
 
void wb::Mat3d::Copy (Mat3dShell< T > &m)
 

Detailed Description

In this module, we defined some useful data structures which will be applied in the algorithm:
Mat/Vec: an application of matrix calculation
Heap: an application of Max-Heap or Min-Heap, used to commit a heap sort.
Lhash: linear hash table, the size will dynamically adjust when elements are added/deleted
Trie: a prefix tree structure. For the children of a same node, the keys are of the same prefix´╝łthe key of their parent)

Function Documentation

§ Compar_Dec()

template<typename T >
int wb::Compar_Dec ( const T &  a,
const T &  b 
)

comparing function for decrease sort

Definition at line 664 of file wb-vector.h.

§ Compar_Inc()

template<typename T >
int wb::Compar_Inc ( const T &  a,
const T &  b 
)

comparing function for increase sort.

Definition at line 657 of file wb-vector.h.

§ Copy() [1/3]

template<class T>
void wb::Vec< T >::Copy ( VecShell< T >  v)

Definition at line 386 of file wb-mat.h.

§ Copy() [2/3]

template<class T>
void wb::Mat< T >::Copy ( MatShell< T > &  m)

Definition at line 475 of file wb-mat.h.

§ Copy() [3/3]

void wb::Mat3d::Copy ( Mat3dShell< T > &  m)

Definition at line 569 of file wb-mat.h.

§ Fill() [1/3]

template<class T>
void wb::VecShell< T >::Fill ( v)

Definition at line 279 of file wb-mat.h.

§ Fill() [2/3]

template<class T>
void wb::MatShell< T >::Fill ( v)

Definition at line 397 of file wb-mat.h.

§ Fill() [3/3]

void wb::Mat3dShell::Fill ( v)

Definition at line 482 of file wb-mat.h.

§ MatVec2()

template<class T >
T wb::MatVec2 ( MatShell< T > &  m,
VecShell< T > &  v1,
VecShell< T > &  v2 
)

calculate V1*M*V2

Definition at line 251 of file wb-mat.h.

§ operator*=()

template<class T>
void wb::VecShell< T >::operator*= ( n)

Definition at line 330 of file wb-mat.h.

§ operator+=()

template<class T >
void wb::VecShell< T >::operator+= ( VecShell< T >  v)

Definition at line 310 of file wb-mat.h.

§ operator-=()

template<class T >
void wb::VecShell< T >::operator-= ( VecShell< T >  v)

Definition at line 320 of file wb-mat.h.

§ operator/=()

template<class T>
void wb::VecShell< T >::operator/= ( n)

Definition at line 337 of file wb-mat.h.

§ operator=()

template<class T >
void wb::VecShell< T >::operator= ( VecShell< T >  v)

Definition at line 302 of file wb-mat.h.

§ operator==() [1/3]

template<class T >
bool wb::VecShell< T >::operator== ( VecShell< T >  v)

Definition at line 344 of file wb-mat.h.

§ operator==() [2/3]

template<class T >
bool wb::MatShell< T >::operator== ( MatShell< T > &  m)

Definition at line 407 of file wb-mat.h.

§ operator==() [3/3]

bool wb::Mat3dShell::operator== ( Mat3dShell m)

Definition at line 524 of file wb-mat.h.

§ operator[]()

template<class T >
T & wb::VecShell< T >::operator[] ( int  i)

Definition at line 289 of file wb-mat.h.

§ Qsort() [1/2]

template<typename T >
void wb::Qsort ( T *  p,
int  low,
int  high,
int(*)(const T &, const T &)  compar = Compar_Inc 
)

Quick sork.

Definition at line 678 of file wb-vector.h.

§ Qsort() [2/2]

template<typename T >
void wb::Qsort ( Array< T > &  a,
int(*)(const T &, const T &)  compar = Compar_Inc 
)

Quick sork, redefine for class Array.

Definition at line 711 of file wb-vector.h.

§ Read() [1/2]

template<class T >
void wb::MatShell< T >::Read ( File file)

Definition at line 429 of file wb-mat.h.

§ Read() [2/2]

void wb::Mat3dShell::Read ( File file)

Definition at line 507 of file wb-mat.h.

§ Reset() [1/3]

template<class T >
void wb::Vec< T >::Reset ( int  size = 0)

Definition at line 360 of file wb-mat.h.

§ Reset() [2/3]

template<class T >
void wb::Mat< T >::Reset ( int  row = 0,
int  col = 0 
)

Definition at line 445 of file wb-mat.h.

§ Reset() [3/3]

void wb::Mat3d::Reset ( int  xdim = 0,
int  ydim = 0,
int  zdim = 0 
)

Definition at line 536 of file wb-mat.h.

§ VecAdd()

template<class T >
void wb::VecAdd ( VecShell< T > &  res,
VecShell< T > &  v1,
VecShell< T > &  v2 
)

calculate V + V

Definition at line 223 of file wb-mat.h.

§ VecAngle()

template<typename T >
double wb::VecAngle ( T *  pVec1,
T *  pVec2,
int  len 
)

[Vec-function] the cos of the angle of v1 and v2

Definition at line 601 of file wb-vector.h.

§ VecDiff()

template<typename T >
double wb::VecDiff ( T *  pVec1,
T *  pVec2,
int  len 
)

[Vec-function] |v1-v2|

Definition at line 591 of file wb-vector.h.

§ VecDot() [1/2]

template<class T >
T wb::VecDot ( VecShell< T > &  v1,
VecShell< T > &  v2 
)

calculate V*V

Definition at line 235 of file wb-mat.h.

§ VecDot() [2/2]

template<typename T >
double wb::VecDot ( T *  pVec1,
T *  pVec2,
int  len 
)

[Vec-function] v1*v2^T

Definition at line 581 of file wb-vector.h.

§ VecEqual()

template<class T >
bool wb::VecEqual ( VecShell< T > &  v1,
VecShell< T > &  v2 
)

calculate V==V

define the friend function

Definition at line 210 of file wb-mat.h.

§ VecNorm()

template<typename T >
double wb::VecNorm ( T *  pVec,
int  len 
)

[Vec-function] sqrt(v*v^T);

Definition at line 571 of file wb-vector.h.

§ VecUnfold()

template<typename T >
void wb::VecUnfold ( const char *  pStr,
Array< T > &  a 
)

[Vec-function] transform the matlab-style vector to a array, such as [1,3:1:7,9] => 1,3,4,5,6,7,9

Definition at line 608 of file wb-vector.h.

§ Write() [1/2]

template<class T >
void wb::MatShell< T >::Write ( File file)

Definition at line 418 of file wb-mat.h.

§ Write() [2/2]

void wb::Mat3dShell::Write ( File file)

Definition at line 492 of file wb-mat.h.