tlds
Transactional Operations for Linked Data Structures
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
adtree.h
Go to the documentation of this file.
1 /* =============================================================================
2  *
3  * adtree.h
4  *
5  * =============================================================================
6  *
7  * Copyright (C) Stanford University, 2006. All Rights Reserved.
8  * Author: Chi Cao Minh
9  *
10  * =============================================================================
11  *
12  * Reference:
13  *
14  * A. Moore and M.-S. Lee. Cached sufficient statistics for efficient machine
15  * learning with large datasets. Journal of Artificial Intelligence Research 8
16  * (1998), pp 67-91.
17  *
18  * =============================================================================
19  *
20  * For the license of bayes/sort.h and bayes/sort.c, please see the header
21  * of the files.
22  *
23  * ------------------------------------------------------------------------
24  *
25  * For the license of kmeans, please see kmeans/LICENSE.kmeans
26  *
27  * ------------------------------------------------------------------------
28  *
29  * For the license of ssca2, please see ssca2/COPYRIGHT
30  *
31  * ------------------------------------------------------------------------
32  *
33  * For the license of lib/mt19937ar.c and lib/mt19937ar.h, please see the
34  * header of the files.
35  *
36  * ------------------------------------------------------------------------
37  *
38  * For the license of lib/rbtree.h and lib/rbtree.c, please see
39  * lib/LEGALNOTICE.rbtree and lib/LICENSE.rbtree
40  *
41  * ------------------------------------------------------------------------
42  *
43  * Unless otherwise noted, the following license applies to STAMP files:
44  *
45  * Copyright (c) 2007, Stanford University
46  * All rights reserved.
47  *
48  * Redistribution and use in source and binary forms, with or without
49  * modification, are permitted provided that the following conditions are
50  * met:
51  *
52  * * Redistributions of source code must retain the above copyright
53  * notice, this list of conditions and the following disclaimer.
54  *
55  * * Redistributions in binary form must reproduce the above copyright
56  * notice, this list of conditions and the following disclaimer in
57  * the documentation and/or other materials provided with the
58  * distribution.
59  *
60  * * Neither the name of Stanford University nor the names of its
61  * contributors may be used to endorse or promote products derived
62  * from this software without specific prior written permission.
63  *
64  * THIS SOFTWARE IS PROVIDED BY STANFORD UNIVERSITY ``AS IS'' AND ANY
65  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
66  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
67  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL STANFORD UNIVERSITY BE LIABLE
68  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
69  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
70  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
71  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
72  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
73  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
74  * THE POSSIBILITY OF SUCH DAMAGE.
75  *
76  * =============================================================================
77  */
78 
79 
80 #ifndef ADTREE_H
81 #define ADTREE_H 1
82 
83 #include <assert.h>
84 #include <stdlib.h>
85 #include "data.h"
86 #include "query.h"
87 #include "vector.h"
88 
89 typedef struct adtree_node {
90  long index;
91  long value;
92  long count;
95 
96 typedef struct adtree_vary {
97  long index;
101 } adtree_vary_t;
102 
103 typedef struct adtree {
104  long numVar;
105  long numRecord;
107 } adtree_t;
108 
109 
110 /* =============================================================================
111  * adtree_alloc
112  * =============================================================================
113  */
114 adtree_t*
115 adtree_alloc ();
116 
117 
118 /* =============================================================================
119  * adtree_free
120  * =============================================================================
121  */
122 void
123 adtree_free (adtree_t* adtreePtr);
124 
125 
126 /* =============================================================================
127  * adtree_make
128  * -- Records in dataPtr will get rearranged
129  * =============================================================================
130  */
131 void
132 adtree_make (adtree_t* adtreePtr, data_t* dataPtr);
133 
134 
135 /* =============================================================================
136  * adtree_getCount
137  * -- queryVector must consist of queries sorted by id
138  * =============================================================================
139  */
140 long
141 adtree_getCount (adtree_t* adtreePtr, vector_t* queryVectorPtr);
142 
143 
144 #endif /* ADTREE_H */
145 
146 
147 /* =============================================================================
148  *
149  * End of adtree.h
150  *
151  * =============================================================================
152  */
struct adtree_node adtree_node_t
long index
Definition: adtree.h:97
adtree_node_t * oneNodePtr
Definition: adtree.h:100
Definition: vector.h:85
struct adtree_vary adtree_vary_t
long mostCommonValue
Definition: adtree.h:98
adtree_node_t * rootNodePtr
Definition: adtree.h:106
void adtree_make(adtree_t *adtreePtr, data_t *dataPtr)
Definition: adtree.c:309
long count
Definition: adtree.h:92
long value
Definition: adtree.h:91
long numRecord
Definition: adtree.h:105
long numVar
Definition: adtree.h:104
Definition: adtree.h:103
struct adtree adtree_t
Definition: adtree.h:89
void adtree_free(adtree_t *adtreePtr)
Definition: adtree.c:205
vector_t * varyVectorPtr
Definition: adtree.h:93
long adtree_getCount(adtree_t *adtreePtr, vector_t *queryVectorPtr)
Definition: adtree.c:449
long index
Definition: adtree.h:90
Definition: adtree.h:96
adtree_t * adtree_alloc()
Definition: adtree.c:163
adtree_node_t * zeroNodePtr
Definition: adtree.h:99
Definition: data.h:80