35 for (
size_t j = 0;
j < 50;
j++) {
36 Int key =
Rand() % 200;
39 Elem *e = hash.
Find(key);
41 else hash.
Insert(key, val);
47 for (
int i = 0;
i < 100;
i++) {
49 for (
typename std::map<Int, T>::const_iterator iter = m1.begin();
52 m2[iter->first + 1] = iter->second;
56 Elem *h = hash.
Clear(), *tmp;
62 for (; h != NULL; h = tmp) {
63 hash.
Insert(h->key + 1, h->val);
69 const Elem *list = hash.
GetList();
71 for (; list != NULL; list = list->tail, count++) {
75 for (
size_t j = 0;
j < 10;
j++) {
76 Int key =
Rand() % 200;
77 bool found_m1 = (m1.find(key) != m1.end());
78 if (found_m1) m1[key];
79 Elem *e = hash.
Find(key);
97 using namespace kaldi;
98 for (
size_t i = 0;
i < 3;
i++) {
99 TestHashList<int, unsigned int>();
100 TestHashList<unsigned int, int>();
101 TestHashList<int16, int32>();
102 TestHashList<int16, int32>();
103 TestHashList<char, unsigned char>();
104 TestHashList<unsigned char, int>();
106 std::cout <<
"Test OK.\n";
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
Elem * Insert(I key, T val)
Insert inserts a new element into the hashtable/stored list.
void swap(basic_filebuf< CharT, Traits > &x, basic_filebuf< CharT, Traits > &y)
void SetSize(size_t sz)
SetSize tells the object how many hash buckets to allocate (should typically be at least twice the nu...
const Elem * GetList() const
Gives the head of the current list to the user.
Elem * Clear()
Clears the hash and gives the head of the current list to the user; ownership is transferred to the u...
int Rand(struct RandomState *state)
#define KALDI_ASSERT(cond)
Elem * Find(I key)
Find tries to find this element in the current list using the hashtable.
void Delete(Elem *e)
Think of this like delete().