-
Notifications
You must be signed in to change notification settings - Fork 3
/
nnitem.h
63 lines (55 loc) · 1.02 KB
/
nnitem.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#ifndef NNITEM_H
#define NNITEM_H
class NNItem
{
public:
NNItem(const unsigned int index, const float dist)
{
this->index = index;
this->val = dist;
}
unsigned int index;
float val;
float base;
float range;
~NNItem()
{
}
//sort in ascending order
static int comparer(const NNItem *a,const NNItem *b)
{
return (a->val < b->val);
}
//sort in descending order
static int lgcomparer(const NNItem *a,const NNItem *b)
{
return (a->val > b->val);
}
};
/********for building a heap************/
class HItem
{
public:
HItem()
{
this->val = 0;
this->visited = false;
}
bool visited;
unsigned int bidx;
float val;
~HItem()
{
}
//sort in ascending order
static int llcomp(const HItem *a,const HItem *b)
{
return (a->val < b->val);
}
//sort in descending order
static int lgcomp(const HItem *a,const HItem *b)
{
return (a->val > b->val);
}
};
#endif