Hitmap 1.3
 All Data Structures Namespaces Files Functions Variables Typedefs Friends Macros Groups Pages
hit_sig.h
Go to the documentation of this file.
1 
16 /*
17  * <license>
18  *
19  * Hitmap v1.2
20  *
21  * This software is provided to enhance knowledge and encourage progress in the scientific
22  * community. It should be used only for research and educational purposes. Any reproduction
23  * or use for commercial purpose, public redistribution, in source or binary forms, with or
24  * without modifications, is NOT ALLOWED without the previous authorization of the copyright
25  * holder. The origin of this software must not be misrepresented; you must not claim that you
26  * wrote the original software. If you use this software for any purpose (e.g. publication),
27  * a reference to the software package and the authors must be included.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS" AND ANY
30  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
34  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
36  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38  *
39  * Copyright (c) 2007-2015, Trasgo Group, Universidad de Valladolid.
40  * All rights reserved.
41  *
42  * More information on http://trasgo.infor.uva.es/
43  *
44  * </license>
45 */
46 
47 #ifndef _HitSig_
48 #define _HitSig_
49 
50 /* Hit SIGNATURES */
79 typedef struct {
80  int begin;
81  int end;
82  int stride;
83 } HitSig;
84 
85 
86 #include "hit_sigP.h"
87 
88 
89 /* 2.1. Hit SIGNATURE NULL CONSTANT */
95 extern HitSig HIT_SIG_NULL;
96 
97 /* 2.2. Hit SIGNATURE WHOLE CONSTANT */
108 extern HitSig HIT_SIG_WHOLE;
109 
110 
111 /* 3. Hit SIGNATURE GENERATING FUNCTION */
120 static inline HitSig hit_sig(int begin, int end, int stride) {
121  HitSig a = { begin, end, stride };
122  return a;
123 }
124 
134 static inline HitSig hit_sigStd(int numElems) {
135  HitSig a = { 0, numElems-1, 1 };
136  return a;
137 }
138 
147 static inline HitSig hit_sigIndex(int ind) {
148  HitSig a = { ind, ind, 1 };
149  return a;
150 }
151 
152 
153 /* 5. Hit SIGNATURE CARDINALITY */
162 #define hit_sigCard(sig) (((sig).end-(sig).begin)/(sig).stride+1)
163 
164 /* 8. Hit SIGNATURE: COMPARISON OPERATOR */
174 #define hit_sigCmp(s1,s2) ((s1).begin == (s2).begin && (s1).end == (s2).end && (s1).stride == (s2).stride)
175 
176 /* 6. Hit CONDITION: NUMBER IN THE DOMAIN OF A SIGNATURE */
186 #define hit_sigIn(sig,ind) ((ind)>=(sig).begin && (ind)<=(sig).end && (((ind)-(sig).begin)%(sig).stride == 0))
187 
188 /* 7. Hit APPLY A ONE-ELEMENT SELECTION THROUGH A SIGNATURE */
198 #define hit_sigTileToArray(sig,ind) ((ind)*(sig).stride+(sig).begin)
199 
209 #define hit_sigArrayToTile(sig,ind) ( (int)(((ind)-(sig).begin)/(sig).stride) )
210 
211 
212 /* 9. Hit SIGNATURE: INTERSECTION OPERATOR */
226 
227 /* END OF HEADER FILE _HitSig_ */
228 #endif
Definition: hit_sig.h:79
HitSig hit_sigIntersect(HitSig s1, HitSig s2)
Definition: hit_sig.c:86
int begin
Definition: hit_sig.h:80
HitSig HIT_SIG_NULL
Definition: hit_sig.c:48
int end
Definition: hit_sig.h:81
HitSig HIT_SIG_WHOLE
Definition: hit_sig.c:49
int stride
Definition: hit_sig.h:82